Github user gatorsmile commented on a diff in the pull request: https://github.com/apache/spark/pull/9419#discussion_r43850164 --- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/Analyzer.scala --- @@ -232,7 +232,7 @@ class Analyzer( // substitute the group by expressions. val newGroupByExprs = groupByExprPairs.map(_._2) --- End diff -- Hi, @chenghao-intel , Could you explain it a little bit more? So far, this query is correctly processed and returned a correct result. Since b is part of an aggregated function, the fix added extra columns for b. Below is the generated plan: `== Analyzed Logical Plan == ab: bigint Aggregate [b#3,grouping__id#12], [sum(cast((a#2 - b#3#13) as bigint)) AS ab#4L] Expand [0,1], [b#3], grouping__id#12 Project [a#2,b#3,b#3 AS b#3#13] Subquery mytable Project [_1#0 AS a#2,_2#1 AS b#3] LocalRelation [_1#0,_2#1], [[1,2],[2,4],[2,9]] == Optimized Logical Plan == Aggregate [b#3,grouping__id#12], [sum(cast((a#2 - b#3#13) as bigint)) AS ab#4L] Expand [0,1], [b#3], grouping__id#12 LocalRelation [a#2,b#3,b#3#13], [[1,2,2],[2,4,4],[2,9,9]]`
--- 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