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

    https://github.com/apache/spark/pull/17899#discussion_r116693306
  
    --- Diff: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/Optimizer.scala
 ---
    @@ -609,6 +610,19 @@ object CollapseWindow extends Rule[LogicalPlan] {
     }
     
     /**
    + * Transpose Adjacent Window Expressions.
    + * - If the partition spec of the parent Window expression is a subset of 
the partition spec
    + *   of the child window expression, transpose them.
    + */
    +object TransposeWindow extends Rule[LogicalPlan] {
    +  def apply(plan: LogicalPlan): LogicalPlan = plan transformUp {
    +    case w1 @ Window(we1, ps1, os1, w2 @ Window(we2, ps2, os2, grandChild))
    +        if ps1.length < ps2.length && ps2.containsSlice(ps1) =>
    +      Project(w1.output, Window(we2, ps2, os2, Window(we1, ps1, os1, 
grandChild)))
    --- End diff --
    
    This probably warrants a follow-up that tries to move projections that are 
wedged in between two window clauses. 


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