[
https://issues.apache.org/jira/browse/BEAM-9300?focusedWorklogId=394507&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-394507
]
ASF GitHub Bot logged work on BEAM-9300:
----------------------------------------
Author: ASF GitHub Bot
Created on: 27/Feb/20 22:23
Start Date: 27/Feb/20 22:23
Worklog Time Spent: 10m
Work Description: robinyqiu commented on 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:
[email protected]
Issue Time Tracking
-------------------
Worklog Id: (was: 394507)
Time Spent: 1h 20m (was: 1h 10m)
> parse struct literal in ZetaSQL
> -------------------------------
>
> Key: BEAM-9300
> URL: https://issues.apache.org/jira/browse/BEAM-9300
> Project: Beam
> Issue Type: New Feature
> Components: dsl-sql-zetasql
> Reporter: Kyle Weaver
> Assignee: Kyle Weaver
> Priority: Major
> Time Spent: 1h 20m
> Remaining Estimate: 0h
>
> https://github.com/apache/beam/blob/b02a325409d55f1ecb7f9fb6ecc4f60a974c810d/sdks/java/extensions/sql/zetasql/src/main/java/org/apache/beam/sdk/extensions/sql/zetasql/translation/ExpressionConverter.java#L569
--
This message was sent by Atlassian Jira
(v8.3.4#803005)