use of org.apache.beam.sdk.extensions.sql.meta.Table in project beam by apache.
the class TestTableProviderWithFilterPushDown method buildUp.
@Before
public void buildUp() {
TestTableProvider tableProvider = new TestTableProvider();
Table table = getTable("TEST", PushDownOptions.FILTER);
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()).setRuleSets(ImmutableList.of(RuleSets.ofList(rulesWithPushDown))).build();
}
use of org.apache.beam.sdk.extensions.sql.meta.Table in project beam by apache.
the class BigQueryTableProviderTest method testSelectWriteDispositionMethodAppend.
@Test
public void testSelectWriteDispositionMethodAppend() {
Table table = fakeTableWithProperties("hello", "{ " + WRITE_DISPOSITION_PROPERTY + ": " + "\"" + WriteDisposition.WRITE_APPEND.toString() + "\" }");
BigQueryTable sqlTable = (BigQueryTable) provider.buildBeamSqlTable(table);
assertEquals(WriteDisposition.WRITE_APPEND, sqlTable.writeDisposition);
}
use of org.apache.beam.sdk.extensions.sql.meta.Table in project beam by apache.
the class BigQueryTableProviderTest method testRuntimeExceptionThrown_whenAnInvalidPropertyIsSpecified.
@Test
public void testRuntimeExceptionThrown_whenAnInvalidPropertyIsSpecified() {
Table table = fakeTableWithProperties("hello", "{ " + METHOD_PROPERTY + ": \"blahblah\" }");
assertThrows(RuntimeException.class, () -> {
provider.buildBeamSqlTable(table);
});
}
use of org.apache.beam.sdk.extensions.sql.meta.Table in project beam by apache.
the class BigQueryTableProviderTest method testRuntimeExceptionThrown_whenAPropertyOfInvalidTypeIsSpecified.
@Test
public void testRuntimeExceptionThrown_whenAPropertyOfInvalidTypeIsSpecified() {
Table table = fakeTableWithProperties("hello", "{ " + METHOD_PROPERTY + ": 1337 }");
assertThrows(RuntimeException.class, () -> {
provider.buildBeamSqlTable(table);
});
}
use of org.apache.beam.sdk.extensions.sql.meta.Table in project beam by apache.
the class KafkaTableProviderTest method testBuildBeamSqlNestedThriftTable.
@Test
public void testBuildBeamSqlNestedThriftTable() {
Table table = mockNestedThriftTable("hello", SimpleThriftMessage.class, TCompactProtocol.Factory.class);
BeamSqlTable sqlTable = provider.buildBeamSqlTable(table);
assertNotNull(sqlTable);
assertTrue(sqlTable instanceof NestedPayloadKafkaTable);
BeamKafkaTable kafkaTable = (BeamKafkaTable) sqlTable;
assertEquals(LOCATION_BROKER, kafkaTable.getBootstrapServers());
assertEquals(ImmutableList.of(LOCATION_TOPIC), kafkaTable.getTopics());
}
Aggregations