use of org.apache.beam.sdk.extensions.sql.meta.provider.test.TestTableProvider in project beam by apache.
the class ZetaSQLPushDownTest method initializeBeamTableProvider.
private static void initializeBeamTableProvider() {
Table projectTable = getTable("InMemoryTableProject", PushDownOptions.PROJECT);
Table bothTable = getTable("InMemoryTableBoth", PushDownOptions.BOTH);
Row[] rows = { row(BASIC_SCHEMA, 100L, 1L, "one", 100L), row(BASIC_SCHEMA, 200L, 2L, "two", 200L) };
tableProvider = new TestTableProvider();
tableProvider.createTable(projectTable);
tableProvider.createTable(bothTable);
tableProvider.addRows(projectTable.getName(), rows);
tableProvider.addRows(bothTable.getName(), rows);
}
use of org.apache.beam.sdk.extensions.sql.meta.provider.test.TestTableProvider in project beam by apache.
the class BeamAggregateProjectMergeRuleTest method buildUp.
@Before
public void buildUp() {
TestTableProvider tableProvider = new TestTableProvider();
Table projectTable = getTable("TEST_PROJECT", PushDownOptions.PROJECT);
Table filterTable = getTable("TEST_FILTER", PushDownOptions.FILTER);
Table noneTable = getTable("TEST_NONE", PushDownOptions.NONE);
tableProvider.createTable(projectTable);
tableProvider.createTable(filterTable);
tableProvider.createTable(noneTable);
// Rules are cost based, need rows to optimize!
tableProvider.addRows("TEST_PROJECT", Row.withSchema(BASIC_SCHEMA).addValues(1, 2, "3", 4).build());
tableProvider.addRows("TEST_FILTER", Row.withSchema(BASIC_SCHEMA).addValues(1, 2, "3", 4).build());
tableProvider.addRows("TEST_NONE", Row.withSchema(BASIC_SCHEMA).addValues(1, 2, "3", 4).build());
sqlEnv = BeamSqlEnv.inMemory(tableProvider);
}
use of org.apache.beam.sdk.extensions.sql.meta.provider.test.TestTableProvider in project beam by apache.
the class BigQueryFilterTest method buildUp.
@Before
public void buildUp() {
TestTableProvider tableProvider = new TestTableProvider();
Table table = getTable("TEST", PushDownOptions.NONE);
tableProvider.createTable(table);
tableProvider.addRows(table.getName(), row(BASIC_SCHEMA, 100, 1, "one", (short) 100, true), row(BASIC_SCHEMA, 200, 2, "two", (short) 200, false));
sqlEnv = BeamSqlEnv.builder(tableProvider).setPipelineOptions(PipelineOptionsFactory.create()).build();
}
use of org.apache.beam.sdk.extensions.sql.meta.provider.test.TestTableProvider in project beam by apache.
the class ThreeTablesSchema method testSystemNotReorderingMediumSmallLarge.
@Test
public void testSystemNotReorderingMediumSmallLarge() {
TestTableProvider tableProvider = new TestTableProvider();
createThreeTables(tableProvider);
BeamSqlEnv env = BeamSqlEnv.withTableProvider(tableProvider);
// This is a correct ordered join because large table is on the top. It should not change that.
BeamRelNode parsedQuery = env.parseQuery("select * from medium_table " + " JOIN small_table on medium_table.small_key = small_table.medium_key " + " JOIN large_table on large_table.medium_key = medium_table.large_key ");
assertTopTableInJoins(parsedQuery, "large_table");
}
use of org.apache.beam.sdk.extensions.sql.meta.provider.test.TestTableProvider in project beam by apache.
the class BeamDDLNestedTypesTest method executeCreateTableWith.
private Table executeCreateTableWith(String fieldType) throws SqlParseException {
String createTable = "CREATE EXTERNAL TABLE tablename ( " + "fieldName " + fieldType + " ) " + "TYPE 'text' " + "LOCATION '/home/admin/person'\n";
System.out.println(createTable);
TestTableProvider tableProvider = new TestTableProvider();
BeamSqlEnv env = BeamSqlEnv.withTableProvider(tableProvider);
env.executeDdl(createTable);
return tableProvider.getTables().get("tablename");
}
Aggregations