use of com.google.zetasql.StructType in project beam by apache.
the class ZetaSqlDialectSpecTest method testParameterStructNested.
@Test
public void testParameterStructNested() {
String sql = "SELECT @outer_struct.inner_struct.s as ColA";
StructType innerStructType = TypeFactory.createStructType(ImmutableList.of(new StructType.StructField("s", TypeFactory.createSimpleType(TypeKind.TYPE_STRING))));
ImmutableMap<String, Value> params = ImmutableMap.of("outer_struct", Value.createStructValue(TypeFactory.createStructType(ImmutableList.of(new StructType.StructField("inner_struct", innerStructType))), ImmutableList.of(Value.createStructValue(innerStructType, ImmutableList.of(Value.createStringValue("foo"))))));
PCollection<Row> stream = execute(sql, params);
final Schema schema = Schema.builder().addStringField("field1").build();
PAssert.that(stream).containsInAnyOrder(Row.withSchema(schema).addValue("foo").build());
pipeline.run().waitUntilFinish(Duration.standardMinutes(PIPELINE_EXECUTION_WAITTIME_MINUTES));
}
Aggregations