use of org.apache.beam.sdk.extensions.sql.meta.provider.test.TestBoundedTable in project beam by apache.
the class CustomTableResolverTest method testDefaultBuildIOReader_withEmptyParams_returnsPCollection.
@Test
public void testDefaultBuildIOReader_withEmptyParams_returnsPCollection() {
TestBoundedTable testTable = TestBoundedTable.of(BASIC_SCHEMA).addRows(1, "one");
Row expected = row(1, "one");
PCollection<Row> resultWithEmpty = testTable.buildIOReader(pipeline.begin(), testTable.constructFilter(ImmutableList.of()), ImmutableList.of());
PAssert.that(resultWithEmpty).containsInAnyOrder(expected);
pipeline.run().waitUntilFinish(Duration.standardMinutes(2));
}
use of org.apache.beam.sdk.extensions.sql.meta.provider.test.TestBoundedTable in project beam by apache.
the class CustomTableResolverTest method testDefaultBuildIOReader_withNonEmptyParams_throwsException.
@Test
public void testDefaultBuildIOReader_withNonEmptyParams_throwsException() {
TestBoundedTable testTable = TestBoundedTable.of(BASIC_SCHEMA).addRows(1, "one");
assertThrows(UnsupportedOperationException.class, () -> testTable.buildIOReader(pipeline.begin(), new BeamSqlTableFilter() {
@Override
public List<RexNode> getNotSupported() {
return null;
}
@Override
public int numSupported() {
return 0;
}
}, ImmutableList.of()));
assertThrows(UnsupportedOperationException.class, () -> testTable.buildIOReader(pipeline.begin(), new DefaultTableFilter(ImmutableList.of()), ImmutableList.of("one")));
pipeline.run().waitUntilFinish(Duration.standardMinutes(2));
}
use of org.apache.beam.sdk.extensions.sql.meta.provider.test.TestBoundedTable in project beam by apache.
the class TestBoundedTableTest method testCreatingEmptyTable.
@Test
public void testCreatingEmptyTable() {
TestBoundedTable emptyTable = TestBoundedTable.of(Schema.builder().addInt32Field("ColId").addStringField("Value").build());
emptyTable.buildIOReader(PBegin.in(pipeline));
pipeline.run();
}
Aggregations