Github user viirya commented on a diff in the pull request: https://github.com/apache/spark/pull/18779#discussion_r130505545 --- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/Analyzer.scala --- @@ -1010,7 +1014,16 @@ class Analyzer( s"(valid range is [1, ${aggs.size}])") case o => o } - Aggregate(newGroups, aggs, child) + // If an aggregateExpression is integer, after replaced with this aggregateExpression, the + // groupExpression will be considered as an ordinal still, so we should filter it. + var filterGroups: Seq[Expression] = Nil + newGroups.foreach { ng => + ng match { + case a: Alias => if (!isIntLiteral (a.child)) filterGroups :+= ng + case _ => filterGroups :+= ng + } + } + Aggregate(filterGroups, aggs, child) --- End diff -- @maropu yap, I think so. Because `RemoveLiteralFromGroupExpressions` takes care of this.
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org