marko-radoicic-db commented on code in PR #59463:
URL: https://github.com/apache/spark/pull/59463#discussion_r4285129812


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/parser/AstBuilder.scala:
##########
@@ -2228,7 +2228,13 @@ class AstBuilder extends DataTypeAstBuilder
     if (ctx.groupingExpressionsWithGroupingAnalytics.isEmpty) {
       val groupByExpressions: Seq[Expression] =
         ctx.groupingExpressions.asScala.map { n: NamedExpressionContext =>
-          if (!allowNamedGroupingExpressions && (n.name != null || 
n.identifierList != null)) {
+          lazy val groupingExpression = visitNamedExpression(n)
+          val allowAlias = allowNamedGroupingExpressions && 
(groupingExpression match {
+            case Alias(Literal(_: Int, IntegerType), _) =>
+              
conf.getConf(SQLConf.LEGACY_ALLOW_ALIASED_PIPE_AGGREGATE_ORDINALS)
+            case _ => true
+          })
+          if (!allowAlias && (n.name != null || n.identifierList != null)) {

Review Comment:
   Now we throw
   ```[UNSUPPORTED_FEATURE.PIPE_OPERATOR_AGGREGATE_UNSUPPORTED_CASE] The 
feature is not supported:
     The SQL pipe operator syntax with aggregation (using |> AGGREGATE) does 
not support aliases
     on GROUP BY ordinals. SQLSTATE: 0A000
     ```



-- 
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]

Reply via email to