cloud-fan commented on code in PR #42837:
URL: https://github.com/apache/spark/pull/42837#discussion_r1317146928


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/DecorrelateInnerQuery.scala:
##########
@@ -664,14 +664,16 @@ object DecorrelateInnerQuery extends PredicateHelper {
               decorrelate(child, newOuterReferences, aggregated = true, 
underSetOp)
             // For now these are no-op, as we don't allow correlated 
references in the window
             // function itself.
-            val newProjectList = replaceOuterReferences(projectList, 
outerReferenceMap)
+            val newWindowExpressions = 
replaceOuterReferences(windowExpressions, outerReferenceMap)
             val newPartitionSpec = replaceOuterReferences(partitionSpec, 
outerReferenceMap)
             val newOrderSpec = replaceOuterReferences(orderSpec, 
outerReferenceMap)
-            val referencesToAdd = missingReferences(newProjectList, joinCond)
+            val referencesToAdd = missingReferences(newWindowExpressions, 
joinCond)
 
-            val newWindow = Window(newProjectList ++ referencesToAdd,

Review Comment:
   look at `Window#output`:
   ```
     override def output: Seq[Attribute] =
       child.output ++ windowExpressions.map(_.toAttribute)
   ```
   
   We don't need to add `referencesToAdd` to propagate the added references, as 
it's already propagated.



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