allisonwang-db commented on a change in pull request #32303:
URL: https://github.com/apache/spark/pull/32303#discussion_r647026800



##########
File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/plans/logical/PlanHelper.scala
##########
@@ -45,6 +45,7 @@ object PlanHelper {
         case e: AggregateExpression
           if !(plan.isInstanceOf[Aggregate] ||
                plan.isInstanceOf[Window] ||
+               plan.isInstanceOf[LateralJoin] ||

Review comment:
       This is because the children (outerAttrs) field can contain aggregate 
expressions `LateralJoin(left, LateralSubquery(plan, [sum(a)]), ..)` when 
collecting outer references in the subquery:
   
   
https://github.com/apache/spark/blob/dfd8a8dc676c388c0c1bb7e4cb8d55eab10504ab/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/subquery.scala#L201-L211




-- 
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:
[email protected]



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

Reply via email to