| 33 | /** |
| 34 | */ |
| 35 | public class SqlHandler extends ASqlHandler { |
| 36 | |
| 37 | public SqlHandler(DDF theDDF) { |
| 38 | super(theDDF); |
| 39 | } |
| 40 | |
| 41 | // private SparkContext getarkContext() { |
| 42 | // return ((SparkDDFManager) this.getManager()).getSharkContext(); |
| 43 | // } |
| 44 | |
| 45 | // ////// IHandleDataCommands //////// |
| 46 | |
| 47 | private HiveContext getHiveContext() { |
| 48 | return ((SparkDDFManager) this.getManager()).getHiveContext(); |
| 49 | } |
| 50 | |
| 51 | @Override |
| 52 | public DDF sql2ddf(String command) throws DDFException { |
| 53 | return this.sql2ddf(command, null, null, null); |
| 54 | } |
| 55 | |
| 56 | @Override |
| 57 | public DDF sql2ddf(String command, Schema schema) throws DDFException { |
| 58 | return this.sql2ddf(command, schema, null, null); |
| 59 | } |
| 60 | |
| 61 | @Override |
| 62 | public DDF sql2ddf(String command, DataFormat dataFormat) throws DDFException { |
| 63 | return this.sql2ddf(command, null, null, dataFormat); |
| 64 | } |
| 65 | |
| 66 | @Override |
| 67 | public DDF sql2ddf(String command, Schema schema, DataSourceDescriptor dataSource) throws DDFException { |
| 68 | return this.sql2ddf(command, schema, dataSource, null); |
| 69 | } |
| 70 | |
| 71 | @Override |
| 72 | public DDF sql2ddf(String command, Schema schema, DataFormat dataFormat) throws DDFException { |
| 73 | return this.sql2ddf(command, schema, null, dataFormat); |
| 74 | } |
| 75 | |
| 76 | //TODO: SparkSql |
| 77 | @Override |
| 78 | public DDF sql2ddf(String command, Schema schema, DataSourceDescriptor dataSource, DataFormat dataFormat) throws DDFException { |
| 79 | // TableRDD tableRdd = null; |
| 80 | // RDD<Row> rddRow = null; |
| 81 | |
| 82 | DataFrame rdd = null; |
| 83 | // TODO: handle other dataSources and dataFormats |
| 84 | if (dataSource != null) { |
| 85 | SQLDataSourceDescriptor sqlDataSourceDescriptor = (SQLDataSourceDescriptor)dataSource; |
| 86 | if (sqlDataSourceDescriptor != null) { |
| 87 | if (sqlDataSourceDescriptor.getDataSource() != null |
| 88 | && !sqlDataSourceDescriptor.getDataSource().equals("SparkSQL") |
| 89 | && !sqlDataSourceDescriptor.getDataSource().equals("Spark") |
| 90 | && !sqlDataSourceDescriptor.getDataSource().equals("spark")) { |
| 91 | throw new DDFException("Incorrect datasource"); |
| 92 | } |
nothing calls this directly
no outgoing calls
no test coverage detected