cloud-fan commented on a change in pull request #34701:
URL: https://github.com/apache/spark/pull/34701#discussion_r758930961



##########
File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/Optimizer.scala
##########
@@ -2162,6 +2163,74 @@ object RemoveLiteralFromGroupExpressions extends 
Rule[LogicalPlan] {
   }
 }
 
+/**
+ * Prunes unnecessary fields from a [[Generate]] if it is under a count 
aggregation
+ * query.
+ */
+object CountAggregateOptimization extends Rule[LogicalPlan] {

Review comment:
       My understanding is, rule `ColumnPruning` will create `Project` with an 
empty project list under count-only aggregate. In the mean while, people can 
use DataFrame API to create empty `Project` as well.
   
   I think it's simpler and more general to target `Project(Nil, 
Generate(...))`. We don't care about how the empty project was created, either 
by count-only aggregate, or by users.




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