use of org.apache.beam.sdk.extensions.sql.impl.BeamSqlEnv in project beam by apache.
the class BeamComplexTypeTest method testNestedRow.
@Test
public void testNestedRow() {
BeamSqlEnv sqlEnv = BeamSqlEnv.inMemory(readOnlyTableProvider);
PCollection<Row> stream = BeamSqlRelUtils.toPCollection(pipeline, sqlEnv.parseQuery("SELECT nestedRowTestTable.col FROM nestedRowTestTable"));
Schema outputSchema = Schema.builder().addRowField("col", nestedRowSchema).build();
PAssert.that(stream).containsInAnyOrder(Row.withSchema(outputSchema).addValues(Row.withSchema(nestedRowSchema).addValues("str", Row.withSchema(innerRowSchema).addValues("inner_str_one", 1L).build(), 2L, Row.withSchema(innerRowSchema).addValues("inner_str_two", 3L).build()).build()).build());
pipeline.run().waitUntilFinish(Duration.standardMinutes(2));
}
Aggregations