cloud-fan commented on a change in pull request #35473:
URL: https://github.com/apache/spark/pull/35473#discussion_r810851479
##########
File path:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/Optimizer.scala
##########
@@ -454,6 +455,40 @@ object EliminateAggregateFilter extends Rule[LogicalPlan] {
}
}
+/**
+ * The rule is applied both normal and AQE Optimizer. It optimizes plan using
max rows:
+ * - if the child of sort max rows less than or equal to 1, remove the sort
+ * - if the child of local sort max rows per partition less than or equal to
1, remove the
+ * local sort
+ * - if the child of aggregate max rows less than or equal to 1 and its
output is subset of
+ * its child and it's grouping only(include the rewritten distinct plan),
remove the aggregate
+ * - if the child of aggregate max rows less than or equal to 1, set
distinct to false in all
+ * aggregate expression
+ */
+object OptimizeOneRowPlan extends Rule[LogicalPlan] {
Review comment:
can we put it in a new file?
--
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]