Github user gatorsmile commented on a diff in the pull request:

    https://github.com/apache/spark/pull/11565#discussion_r55304511
  
    --- Diff: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/Optimizer.scala
 ---
    @@ -345,8 +343,6 @@ object ColumnPruning extends Rule[LogicalPlan] {
         // Prunes the unused columns from child of 
Aggregate/Window/Expand/Generate
         case a @ Aggregate(_, _, child) if (child.outputSet -- 
a.references).nonEmpty =>
           a.copy(child = prunedChild(child, a.references))
    -    case w @ Window(_, _, _, _, child) if (child.outputSet -- 
w.references).nonEmpty =>
    --- End diff --
    
    First, `w.outputSet` always include `child.outputSet`.
    
    Second, `w.references` only include the expressions present in the current 
`Window` operator. This set does not include attributes that are implicitly 
referenced by being passed through to the output tuple. Thus, it is not valid 
now. It will wrongly prune the child, if we keep it. Please correct me if my 
understanding is wrong. 


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