maropu commented on a change in pull request #30212:
URL: https://github.com/apache/spark/pull/30212#discussion_r531397913



##########
File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/Analyzer.scala
##########
@@ -628,15 +627,17 @@ class Analyzer(override val catalogManager: 
CatalogManager)
       if (resolvedInfo.nonEmpty) {
         val (extraAggExprs, resolvedHavingCond) = resolvedInfo.get
         val newChild = h.child match {
-          case Aggregate(Seq(c @ Cube(groupByExprs)), aggregateExpressions, 
child) =>
+          case Aggregate(Seq(c @ Cube(groupingSets)), aggregateExpressions, 
child) =>
             constructAggregate(
-              cubeExprs(groupByExprs), groupByExprs, aggregateExpressions ++ 
extraAggExprs, child)
-          case Aggregate(Seq(r @ Rollup(groupByExprs)), aggregateExpressions, 
child) =>
+              cubeExprs(groupingSets),
+              c.groupByExprs, aggregateExpressions ++ extraAggExprs, child)
+          case Aggregate(Seq(r @ Rollup(groupingSets)), aggregateExpressions, 
child) =>
             constructAggregate(
-              rollupExprs(groupByExprs), groupByExprs, aggregateExpressions ++ 
extraAggExprs, child)
-          case x: GroupingSets =>
+              rollupExprs(groupingSets),
+              r.groupByExprs, aggregateExpressions ++ extraAggExprs, child)
+          case Aggregate(Seq(gs @ GroupingSets(groupingSets, _)), 
aggregateExpressions, child) =>
             constructAggregate(
-              x.selectedGroupByExprs, x.groupByExprs, x.aggregations ++ 
extraAggExprs, x.child)
+              groupingSets, gs.groupByExprs, aggregateExpressions ++ 
extraAggExprs, child)

Review comment:
       Could you merge the three entries above into one, too?




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

Reply via email to