AngersZhuuuu commented on a change in pull request #30212: URL: https://github.com/apache/spark/pull/30212#discussion_r531396965
########## File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/Analyzer.scala ########## @@ -611,14 +609,15 @@ class Analyzer(override val catalogManager: CatalogManager) val aggForResolving = h.child match { // For CUBE/ROLLUP expressions, to avoid resolving repeatedly, here we delete them from // groupingExpressions for condition resolving. - case a @ Aggregate(Seq(c @ Cube(groupByExprs)), _, _) => - a.copy(groupingExpressions = groupByExprs) - case a @ Aggregate(Seq(r @ Rollup(groupByExprs)), _, _) => - a.copy(groupingExpressions = groupByExprs) - case g: GroupingSets => - Aggregate( - getFinalGroupByExpressions(g.selectedGroupByExprs, g.groupByExprs), - g.aggregations, g.child) + case a @ Aggregate(Seq(c @ Cube(_)), _, _) => + a.copy(groupingExpressions = + getFinalGroupByExpressions(c.groupingSets, c.groupByExprs)) + case a @ Aggregate(Seq(r @ Rollup(_)), _, _) => Review comment: Done ########## File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/Analyzer.scala ########## @@ -611,14 +609,15 @@ class Analyzer(override val catalogManager: CatalogManager) val aggForResolving = h.child match { // For CUBE/ROLLUP expressions, to avoid resolving repeatedly, here we delete them from // groupingExpressions for condition resolving. - case a @ Aggregate(Seq(c @ Cube(groupByExprs)), _, _) => - a.copy(groupingExpressions = groupByExprs) - case a @ Aggregate(Seq(r @ Rollup(groupByExprs)), _, _) => - a.copy(groupingExpressions = groupByExprs) - case g: GroupingSets => - Aggregate( - getFinalGroupByExpressions(g.selectedGroupByExprs, g.groupByExprs), - g.aggregations, g.child) + case a @ Aggregate(Seq(c @ Cube(_)), _, _) => + a.copy(groupingExpressions = + getFinalGroupByExpressions(c.groupingSets, c.groupByExprs)) + case a @ Aggregate(Seq(r @ Rollup(_)), _, _) => + a.copy(groupingExpressions = + getFinalGroupByExpressions(r.groupingSets, r.groupByExprs)) + case a @ Aggregate(Seq(gs @ GroupingSets(_, _)), _, _) => Review comment: > ditto Done ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org