[ https://issues.apache.org/jira/browse/BEAM-11808?focusedWorklogId=707960&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-707960 ]
ASF GitHub Bot logged work on BEAM-11808: ----------------------------------------- Author: ASF GitHub Bot Created on: 12/Jan/22 23:46 Start Date: 12/Jan/22 23:46 Worklog Time Spent: 10m Work Description: ibzib commented on a change in pull request #16200: URL: https://github.com/apache/beam/pull/16200#discussion_r783400048 ########## File path: sdks/java/extensions/sql/zetasql/src/main/java/org/apache/beam/sdk/extensions/sql/zetasql/translation/AggregateScanConverter.java ########## @@ -240,18 +244,22 @@ private AggregateCall convertAggCall( } List<Integer> argList = new ArrayList<>(); - for (ResolvedExpr expr : - ((ResolvedAggregateFunctionCall) computedColumn.getExpr()).getArgumentList()) { + ResolvedAggregateFunctionCall expr = ((ResolvedAggregateFunctionCall) computedColumn.getExpr()); + List<ZetaSQLResolvedNodeKind.ResolvedNodeKind> resolvedNodeKinds = + Arrays.asList(RESOLVED_CAST, RESOLVED_COLUMN_REF, RESOLVED_GET_STRUCT_FIELD); + for (int i = 0; i < expr.getArgumentList().size(); i++) { // Throw an error if aggregate function's input isn't either a ColumnRef or a cast(ColumnRef). // TODO: is there a general way to handle aggregation calls conversion? - if (expr.nodeKind() == RESOLVED_CAST - || expr.nodeKind() == RESOLVED_COLUMN_REF - || expr.nodeKind() == RESOLVED_GET_STRUCT_FIELD) { + ZetaSQLResolvedNodeKind.ResolvedNodeKind resolvedNodeKind = + expr.getArgumentList().get(i).nodeKind(); + if (i == 0 && resolvedNodeKinds.contains(resolvedNodeKind)) { Review comment: Alright, for now let's do this: - Throw an UnsupportedOperationException when literals are passed as the first argument. In other words, keep the current behavior (prior to this PR). - Remove the new array_agg and timestamp test cases. - We can add support for literals later if we think it's important. I filed a separate JIRA: https://issues.apache.org/jira/browse/BEAM-13648 -- 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. To unsubscribe, e-mail: github-unsubscr...@beam.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org Issue Time Tracking ------------------- Worklog Id: (was: 707960) Time Spent: 5h (was: 4h 50m) > ZetaSQL layer doesn't support aggregate functions with two arguments > --------------------------------------------------------------------- > > Key: BEAM-11808 > URL: https://issues.apache.org/jira/browse/BEAM-11808 > Project: Beam > Issue Type: Improvement > Components: dsl-sql-zetasql > Reporter: Sonam Ramchand > Assignee: Benjamin Gonzalez > Priority: P3 > Time Spent: 5h > Remaining Estimate: 0h > > Blocked by: parsed ZetaSQL to a Calcite logical expression doesn't currently > support aggregate functions with multiple columns. > [https://github.com/apache/beam/blob/3bb232fb098700de408f574585dfe74bbaff7230/sdks/java/extensions/sql/zetasql/src/main/java/org/apache/beam/sdk/extensions/sql/zetasql/translation/AggregateScanConverter.java#L147] -- This message was sent by Atlassian Jira (v8.20.1#820001)