EnricoMi commented on code in PR #39754:
URL: https://github.com/apache/spark/pull/39754#discussion_r1452192616


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/Analyzer.scala:
##########
@@ -3286,6 +3265,25 @@ class Analyzer(override val catalogManager: 
CatalogManager) extends RuleExecutor
     }
   }
 
+  /**
+   * Resolves expressions against their scope of attributes.
+   */
+  object ResolveScopedExpression extends Rule[LogicalPlan] {
+    override def apply(plan: LogicalPlan): LogicalPlan = 
plan.resolveExpressions {
+      case se: ScopedExpression if se.resolved => se.child
+      case se @ ScopedExpression(expr, attributes) =>

Review Comment:
   > to be safe, I think we can keep a lambda in `ScopedExpression`, which 
takes the children plans and returns the output attributes. then the lambda can 
match `AppendColumns`
   
   I don't get this, can you show how applying that lambda on this example 
query plan works:
   
   - CoGroup
     - f
     - leftGrouping
     - rightGrouping
     - leftData
     - rightData
     - leftScopedOrder: ScopedExpression(leftOrder, leftData)
     - rightScopedOrder: ScopedExpression(rightOrder, rightData)
     - left: AppendColumns(leftChild)
     - right: AppendColumns(rightChild)



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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to