use of org.apache.beam.sdk.extensions.sql.meta.BeamSqlTable in project beam by apache.
the class PubsubLiteTableProviderTest method topicTableCannotRead.
@Test
@SuppressWarnings("argument.type.incompatible")
public void topicTableCannotRead() {
BeamSqlTable basic = makeTable(FULL_WRITE_SCHEMA, example(TopicPath.class).toString(), ImmutableMap.of());
assertThrows(UnsupportedOperationException.class, () -> basic.buildIOReader(null));
}
use of org.apache.beam.sdk.extensions.sql.meta.BeamSqlTable in project beam by apache.
the class TestTableProviderTest method buildUp.
@Before
public void buildUp() {
TestTableProvider tableProvider = new TestTableProvider();
Table table = getTable("tableName");
tableProvider.createTable(table);
tableProvider.addRows(table.getName(), row(BASIC_SCHEMA, 1, "one"), row(BASIC_SCHEMA, 2, "two"));
beamSqlTable = tableProvider.buildBeamSqlTable(table);
}
use of org.apache.beam.sdk.extensions.sql.meta.BeamSqlTable in project beam by apache.
the class BigQueryTableProviderTest method testBuildBeamSqlTable.
@Test
public void testBuildBeamSqlTable() throws Exception {
Table table = fakeTable("hello");
BeamSqlTable sqlTable = provider.buildBeamSqlTable(table);
assertNotNull(sqlTable);
assertTrue(sqlTable instanceof BigQueryTable);
BigQueryTable bqTable = (BigQueryTable) sqlTable;
assertEquals("project:dataset.table", bqTable.bqLocation);
}
use of org.apache.beam.sdk.extensions.sql.meta.BeamSqlTable in project beam by apache.
the class InMemoryMetaStoreTest method testBuildBeamSqlTable.
@Test
public void testBuildBeamSqlTable() throws Exception {
Table table = mockTable("hello");
store.createTable(table);
BeamSqlTable actualSqlTable = store.buildBeamSqlTable(table);
assertNotNull(actualSqlTable);
assertEquals(Schema.builder().addNullableField("id", Schema.FieldType.INT32).addNullableField("name", Schema.FieldType.STRING).build(), actualSqlTable.getSchema());
}
use of org.apache.beam.sdk.extensions.sql.meta.BeamSqlTable in project beam by apache.
the class BeamJoinRel method seekable.
/**
* check if {@code BeamRelNode} implements {@code BeamSeekableTable}.
*/
public static boolean seekable(BeamRelNode relNode) {
if (relNode instanceof BeamIOSourceRel) {
BeamIOSourceRel srcRel = (BeamIOSourceRel) relNode;
BeamSqlTable sourceTable = srcRel.getBeamSqlTable();
if (sourceTable instanceof BeamSqlSeekableTable) {
return true;
}
}
return false;
}
Aggregations