You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "cloud-fan (via GitHub)" <gi...@apache.org> on 2023/09/06 11:35:19 UTC

[GitHub] [spark] cloud-fan commented on a diff in pull request #42837: [WIP] enforce Window#windowExpressions to be window expressions only

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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org