Github user cloud-fan commented on a diff in the pull request:

    https://github.com/apache/spark/pull/11565#discussion_r55634864
  
    --- Diff: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/Optimizer.scala
 ---
    @@ -387,6 +381,14 @@ object ColumnPruning extends Rule[LogicalPlan] {
         // Can't prune the columns on LeafNode
         case p @ Project(_, l: LeafNode) => p
     
    +    // Prune windowExpressions and child of Window
    +    case p @ Project(_, w: Window) if (w.outputSet -- 
p.references).nonEmpty =>
    +      val newWindowExprs = 
w.windowExpressions.filter(p.references.contains)
    +      val newGrandChild = prunedChild(w.child, w.references ++ 
p.references)
    --- End diff --
    
    `w.references ++ p.references` are not the attributes we need from child 
right? First, we may filter out some window expressions and `w.references` is 
out of date. Second, `w.child.output` will never contains `p.reference`, as 
`Window` operator only produce window function results.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

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

Reply via email to