You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2022/02/21 07:49:28 UTC

[GitHub] [spark] cloud-fan commented on a change in pull request #35473: [SPARK-38162][SQL] Optimize one row plan in normal and AQE Optimizer

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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org