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



##########
File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/Analyzer.scala
##########
@@ -1529,7 +1475,25 @@ class Analyzer(override val catalogManager: 
CatalogManager)
         }
 
         val resolvedGroupingExprs = a.groupingExpressions
-          .map(resolveExpressionTopDown(_, planForResolve, trimAlias = true))
+          .map {
+            case c @ Cube(groupingSets) =>
+              c.copy(groupingSets =
+                groupingSets.map(_.map(resolveExpressionTopDown(_, a, 
trimAlias = true))

Review comment:
       > Hm, I see. Since these extra entries for `GroupingSet` make the 
analyzer more complicated, could you find another approach for removing them? 
IIUC these entries are needed because `GroupingSet` holds `grpuingSets` as 
non-children exprs. For example, it seems `groupingSets` exprs and its children 
(`groupByExprs` exprs) looks duplicated, so is it possible to replace 
`groupingSets` exprs with integer indices to `groupByExprs` ?
   
   This complexed code make me confused too, and I have tried to find way to 
solve this but failed, thanks for your suggestion about use `integer indices `. 
I have change the code to convert to/from `groupingSets` and `children` to 
remove such, and it works.  How about current code?
   
   > `groupingSets` exprs and its children (`groupByExprs` exprs) looks 
duplicated, so is it possible to replace `groupingSets` exprs with integer 
indices to `groupByExprs` ?
   
   I think change code about about `groupByExprs` and `groupingSets` make it 
hard to understand. So I change to use relation about `children` and 
`groupjngSets`
   
   
   




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