use of org.apache.beam.sdk.extensions.sql.meta.Table in project beam by apache.
the class KafkaTableProviderTest method testBuildWithExtraServers.
@Test
public void testBuildWithExtraServers() {
Table table = mockTableWithExtraServers("hello", ImmutableList.of("localhost:1111", "localhost:2222"));
BeamSqlTable sqlTable = provider.buildBeamSqlTable(table);
assertNotNull(sqlTable);
assertTrue(sqlTable instanceof BeamKafkaCSVTable);
BeamKafkaCSVTable kafkaTable = (BeamKafkaCSVTable) sqlTable;
assertEquals(LOCATION_BROKER + ",localhost:1111,localhost:2222", kafkaTable.getBootstrapServers());
assertEquals(ImmutableList.of(LOCATION_TOPIC), kafkaTable.getTopics());
}
use of org.apache.beam.sdk.extensions.sql.meta.Table in project beam by apache.
the class KafkaTableProviderTest method testBuildBeamSqlThriftTable.
@Test
public void testBuildBeamSqlThriftTable() {
Table table = mockThriftTable("hello", SimpleThriftMessage.class, TCompactProtocol.Factory.class);
BeamSqlTable sqlTable = provider.buildBeamSqlTable(table);
assertNotNull(sqlTable);
assertTrue(sqlTable instanceof BeamKafkaTable);
BeamKafkaTable kafkaTable = (BeamKafkaTable) sqlTable;
assertEquals(LOCATION_BROKER, kafkaTable.getBootstrapServers());
assertEquals(ImmutableList.of(LOCATION_TOPIC), kafkaTable.getTopics());
}
use of org.apache.beam.sdk.extensions.sql.meta.Table in project beam by apache.
the class KafkaTableProviderTest method testBuildBeamSqlCSVTable.
@Test
public void testBuildBeamSqlCSVTable() {
Table table = mockTable("hello");
BeamSqlTable sqlTable = provider.buildBeamSqlTable(table);
assertNotNull(sqlTable);
assertTrue(sqlTable instanceof BeamKafkaCSVTable);
BeamKafkaCSVTable kafkaTable = (BeamKafkaCSVTable) sqlTable;
assertEquals(LOCATION_BROKER, kafkaTable.getBootstrapServers());
assertEquals(ImmutableList.of(LOCATION_TOPIC), kafkaTable.getTopics());
}
use of org.apache.beam.sdk.extensions.sql.meta.Table in project beam by apache.
the class KafkaTableProviderTest method testBuildWithExtraTopics.
@Test
public void testBuildWithExtraTopics() {
Table table = mockTableWithExtraTopics("hello", ImmutableList.of("topic2", "topic3"));
BeamSqlTable sqlTable = provider.buildBeamSqlTable(table);
assertNotNull(sqlTable);
assertTrue(sqlTable instanceof BeamKafkaCSVTable);
BeamKafkaCSVTable kafkaTable = (BeamKafkaCSVTable) sqlTable;
assertEquals(LOCATION_BROKER, kafkaTable.getBootstrapServers());
assertEquals(ImmutableList.of(LOCATION_TOPIC, "topic2", "topic3"), kafkaTable.getTopics());
}
use of org.apache.beam.sdk.extensions.sql.meta.Table in project beam by apache.
the class MongoDbFilterTest 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();
}
Aggregations