dtenedor commented on code in PR #48529:
URL: https://github.com/apache/spark/pull/48529#discussion_r1813250307
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/parser/AstBuilder.scala:
##########
@@ -5899,7 +5915,80 @@ class AstBuilder extends DataTypeAstBuilder
visitSetOperationImpl(left, plan(ctx.right), all, c.getType)
}.getOrElse(Option(ctx.queryOrganization).map { c =>
withQueryResultClauses(c, withSubqueryAlias(), forPipeOperators = true)
- }.get)))))))
+ }.getOrElse(
+ visitOperatorPipeAggregate(ctx, left)
+ ))))))))
+ }
+
+ private def visitOperatorPipeAggregate(
+ ctx: OperatorPipeRightSideContext, left: LogicalPlan): LogicalPlan = {
+ assert(ctx.AGGREGATE != null)
+ if (ctx.namedExpressionSeq() == null && ctx.aggregationClause() == null) {
+ operationNotAllowed(
+ "The AGGREGATE clause requires a list of aggregate expressions " +
+ "or a list of grouping expressions, or both", ctx)
+ }
+ val aggregateExpressions: Seq[NamedExpression] =
+ Option(ctx.namedExpressionSeq()).map { n: NamedExpressionSeqContext =>
+ visitNamedExpressionSeq(n).map {
+ case (e: NamedExpression, _) => e
+ case (e: Expression, aliasFunc) => UnresolvedAlias(e, aliasFunc)
+ }
+ }.getOrElse(Seq.empty)
+ Option(ctx.aggregationClause()).map { c: AggregationClauseContext =>
+ withAggregationClause(c, aggregateExpressions, left,
allowNamedGroupingExpressions = true)
Review Comment:
Sure, let me consolidate this thread with the other discussion thread since
Gengliang asked the same question :)
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]