zml1206 commented on code in PR #44145:
URL: https://github.com/apache/spark/pull/44145#discussion_r1473972315


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/InferWindowGroupLimit.scala:
##########
@@ -17,21 +17,25 @@
 
 package org.apache.spark.sql.catalyst.optimizer
 
-import org.apache.spark.sql.catalyst.expressions.{Alias, Attribute, 
CurrentRow, DenseRank, EqualTo, Expression, GreaterThan, GreaterThanOrEqual, 
IntegerLiteral, LessThan, LessThanOrEqual, Literal, NamedExpression, 
PredicateHelper, Rank, RowFrame, RowNumber, SpecifiedWindowFrame, 
UnboundedPreceding, WindowExpression, WindowSpecDefinition}
-import org.apache.spark.sql.catalyst.plans.logical.{Filter, Limit, 
LocalRelation, LogicalPlan, Window, WindowGroupLimit}
+import org.apache.spark.sql.catalyst.expressions.{Alias, Attribute, 
CurrentRow, DenseRank, EqualTo, Expression, GreaterThan, GreaterThanOrEqual, 
IntegerLiteral, LessThan, LessThanOrEqual, Literal, NamedExpression, 
PredicateHelper, Rank, RowFrame, RowNumber, SizeBasedWindowFunction, 
SpecifiedWindowFrame, UnboundedPreceding, WindowExpression, 
WindowSpecDefinition}
+import org.apache.spark.sql.catalyst.plans.logical._
 import org.apache.spark.sql.catalyst.rules.Rule
-import org.apache.spark.sql.catalyst.trees.TreePattern.{FILTER, WINDOW}
+import org.apache.spark.sql.catalyst.trees.TreePattern.{FILTER, LIMIT, WINDOW}
 
 /**
  * Inserts a `WindowGroupLimit` below `Window` if the `Window` has rank-like 
functions
- * and the function results are further filtered by limit-like predicates. 
Example query:
+ * and the function results are further filtered by limit-like predicates or 
cumulative
+ * aggregation with limit excludes `SizeBasedWindowFunction`. Example query:

Review Comment:
   Start a new PR is better? Because bug is caused by rank-like filter throuth 
window, this pr is limit throuth window.



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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to