Github user gatorsmile commented on a diff in the pull request:
https://github.com/apache/spark/pull/17899#discussion_r115346396
--- Diff:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/Optimizer.scala
---
@@ -609,6 +610,19 @@ object CollapseWindow extends Rule[LogicalPlan] {
}
/**
+ * Flip Adjacent Window Expressions.
+ * - If the partition spec of the parent Window expression is a subset of
the partition spec
+ * of the child window expression, flip them.
+ */
+object FlipWindow extends Rule[LogicalPlan] {
+ def apply(plan: LogicalPlan): LogicalPlan = plan transformUp {
+ case w1 @ Window(we1, ps1, os1, w2 @ Window(we2, ps2, os2, grandChild))
+ if ps2.containsSlice(ps1) =>
--- End diff --
This condition might not be enough. `we1` might depend on the outputs of
`we2`, right?
---
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]