SamzaExecutor implements SqlExecutor { SqlSchema generateResultSchema(Config config) { SamzaSqlDslConverter converter = (SamzaSqlDslConverter) new SamzaSqlDslConverterFactory().create(config); RelRoot relRoot = converter.convertDsl("").iterator().next(); List<String> colNames = new ArrayList<>(); List<String> colTypeNames = new ArrayList<>(); for (RelDataTypeField dataTypeField : relRoot.validatedRowType.getFieldList()) { colNames.add(dataTypeField.getName()); colTypeNames.add(dataTypeField.getType().toString()); } return new SqlSchema(colNames, Collections.emptyList()); }  @Override void start(ExecutionContext context); @Override void stop(ExecutionContext context); @Override EnvironmentVariableHandler getEnvironmentVariableHandler(); @Override List<String> listTables(ExecutionContext context); @Override SqlSchema getTableSchema(ExecutionContext context, String tableName); @Override QueryResult executeQuery(ExecutionContext context, String statement); @Override int getRowCount(); @Override List<String[]> retrieveQueryResult(ExecutionContext context, int startRow, int endRow); @Override List<String[]> consumeQueryResult(ExecutionContext context, int startRow, int endRow); @Override NonQueryResult executeNonQuery(ExecutionContext context, File sqlFile); @Override NonQueryResult executeNonQuery(ExecutionContext context, List<String> statement); @Override void stopExecution(ExecutionContext context, int exeId); @Override void removeExecution(ExecutionContext context, int exeId); @Override ExecutionStatus queryExecutionStatus(int execId); @Override List<SqlFunction> listFunctions(ExecutionContext context); @Override String getVersion();  }
@Ignore @Test public void testGenerateResultSchema() { prepareEnvironmentVariable(); Map<String, String> mapConf = mExecutor.fetchSamzaSqlConfig(1); SqlSchema ts = mExecutor.generateResultSchema(new MapConfig(mapConf)); List<SqlSchema.SqlField> fields = ts.getFields(); Assert.assertEquals("__key__", fields.get(0).getFieldName()); Assert.assertEquals("Name", fields.get(1).getFieldName()); Assert.assertEquals("NewCompany", fields.get(2).getFieldName()); Assert.assertEquals("OldCompany", fields.get(3).getFieldName()); Assert.assertEquals("ProfileChangeTimestamp", fields.get(4).getFieldName()); Assert.assertEquals("ANY", fields.get(0).getFieldSchema().getFieldType().toString()); Assert.assertEquals("VARCHAR", fields.get(1).getFieldSchema().getFieldType().toString()); Assert.assertEquals("VARCHAR", fields.get(2).getFieldSchema().getFieldType().toString()); Assert.assertEquals("VARCHAR", fields.get(3).getFieldSchema().getFieldType().toString()); Assert.assertEquals("BIGINT", fields.get(4).getFieldSchema().getFieldType().toString()); }