robinyqiu commented on a change in pull request #10967: [BEAM-9300] convert struct literal in ZetaSQL URL: https://github.com/apache/beam/pull/10967#discussion_r384855068
########## File path: sdks/java/extensions/sql/zetasql/src/test/java/org/apache/beam/sdk/extensions/sql/zetasql/ZetaSQLDialectSpecTest.java ########## @@ -3249,6 +3248,68 @@ public void testNamedParameterQuery() { pipeline.run().waitUntilFinish(Duration.standardMinutes(PIPELINE_EXECUTION_WAITTIME_MINUTES)); } + @Test + public void testParameterStruct() { + String sql = "SELECT @p as ColA"; + ImmutableMap<String, Value> params = + ImmutableMap.of( + "p", + Value.createStructValue( + TypeFactory.createStructType( + ImmutableList.of( + new StructType.StructField( + "s", TypeFactory.createSimpleType(TypeKind.TYPE_STRING)), + new StructType.StructField( + "i", TypeFactory.createSimpleType(TypeKind.TYPE_INT64)))), + ImmutableList.of(Value.createStringValue("foo"), Value.createInt64Value(1L)))); + + ZetaSQLQueryPlanner zetaSQLQueryPlanner = new ZetaSQLQueryPlanner(config); + BeamRelNode beamRelNode = zetaSQLQueryPlanner.convertToBeamRel(sql, params); + PCollection<Row> stream = BeamSqlRelUtils.toPCollection(pipeline, beamRelNode); + + final Schema innerSchema = + Schema.of(Field.of("s", FieldType.STRING), Field.of("i", FieldType.INT64)); + final Schema schema = + Schema.builder().addNullableField("field1", FieldType.row(innerSchema)).build(); Review comment: Why does the outerSchema need to be nullable here? ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services