cloud-fan commented on a change in pull request #24411: [SPARK-27514] Skip
collapsing windows with empty window expressions
URL: https://github.com/apache/spark/pull/24411#discussion_r276879280
##########
File path:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/Optimizer.scala
##########
@@ -770,6 +770,7 @@ object CollapseWindow extends Rule[LogicalPlan] {
def apply(plan: LogicalPlan): LogicalPlan = plan transformUp {
case w1 @ Window(we1, ps1, os1, w2 @ Window(we2, ps2, os2, grandChild))
if ps1 == ps2 && os1 == os2 &&
w1.references.intersect(w2.windowOutputSet).isEmpty &&
+ we1.nonEmpty && we2.nonEmpty &&
Review comment:
just for curiosity: do you know why we can't collapse windows with empty
window expressions? Seems we can change
`WindowFunctionType.functionType(we1.head) ==
WindowFunctionType.functionType(we2.head)` to `we1.isEmpty || we2.isEmpty ||
WindowFunctionType.functionType(we1.head) ==
WindowFunctionType.functionType(we2.head)`
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]