use of org.apache.beam.sdk.extensions.sql.meta.BeamSqlTable in project beam by apache.
the class KafkaTableProviderTest method testBuildBeamSqlNestedBytesTable.
@Test
public void testBuildBeamSqlNestedBytesTable() {
Table table = mockNestedBytesTable("hello");
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());
}
use of org.apache.beam.sdk.extensions.sql.meta.BeamSqlTable in project beam by apache.
the class MongoDbTableProviderTest method testBuildBeamSqlTable.
@Test
public void testBuildBeamSqlTable() {
Table table = fakeTable("TEST", "mongodb://localhost:27017/database/collection");
BeamSqlTable sqlTable = provider.buildBeamSqlTable(table);
assertNotNull(sqlTable);
assertTrue(sqlTable instanceof MongoDbTable);
MongoDbTable mongoTable = (MongoDbTable) sqlTable;
assertEquals("mongodb://localhost:27017", mongoTable.dbUri);
assertEquals("database", mongoTable.dbName);
assertEquals("collection", mongoTable.dbCollection);
}
use of org.apache.beam.sdk.extensions.sql.meta.BeamSqlTable in project beam by apache.
the class PubsubTableProviderTest method testCreatesTableWithJustTimestamp.
@Test
public void testCreatesTableWithJustTimestamp() {
PubsubTableProvider provider = new PubsubTableProvider();
Schema messageSchema = Schema.builder().addDateTimeField("event_timestamp").build();
Table tableDefinition = tableDefinition().schema(messageSchema).build();
BeamSqlTable pubsubTable = provider.buildBeamSqlTable(tableDefinition);
assertNotNull(pubsubTable);
assertEquals(messageSchema, pubsubTable.getSchema());
}
use of org.apache.beam.sdk.extensions.sql.meta.BeamSqlTable in project beam by apache.
the class PubsubTableProviderTest method testCreatesTable.
@Test
public void testCreatesTable() {
PubsubTableProvider provider = new PubsubTableProvider();
Schema messageSchema = Schema.builder().addDateTimeField("event_timestamp").addMapField("attributes", VARCHAR, VARCHAR).addRowField("payload", Schema.builder().build()).build();
Table tableDefinition = tableDefinition().schema(messageSchema).build();
BeamSqlTable pubsubTable = provider.buildBeamSqlTable(tableDefinition);
assertNotNull(pubsubTable);
assertEquals(messageSchema, pubsubTable.getSchema());
}
use of org.apache.beam.sdk.extensions.sql.meta.BeamSqlTable in project beam by apache.
the class PubsubLiteTableProviderTest method validSubscriptionTables.
@Test
public void validSubscriptionTables() {
BeamSqlTable basic = makeTable(FULL_READ_SCHEMA, example(SubscriptionPath.class).toString(), ImmutableMap.of());
assertTrue(basic instanceof PubsubLiteSubscriptionTable);
BeamSqlTable row = makeTable(Schema.builder().addRowField(RowHandler.PAYLOAD_FIELD, Schema.builder().addStringField("abc").build()).build(), example(SubscriptionPath.class).toString(), ImmutableMap.of("format", "json"));
assertTrue(row instanceof PubsubLiteSubscriptionTable);
BeamSqlTable dlq = makeTable(Schema.builder().addRowField(RowHandler.PAYLOAD_FIELD, Schema.builder().addStringField("abc").build()).build(), example(SubscriptionPath.class).toString(), ImmutableMap.of("format", "json", "deadLetterQueue", "pubsub:projects/abc/topics/def"));
assertTrue(dlq instanceof PubsubLiteSubscriptionTable);
}
Aggregations