c21 commented on a change in pull request #33711:
URL: https://github.com/apache/spark/pull/33711#discussion_r687195422



##########
File path: 
sql/core/src/main/scala/org/apache/spark/sql/execution/bucketing/DisableUnnecessaryBucketedScan.scala
##########
@@ -120,7 +120,7 @@ object DisableUnnecessaryBucketedScan extends 
Rule[SparkPlan] {
 
   private def hasInterestingPartition(plan: SparkPlan): Boolean = {
     plan.requiredChildDistribution.exists {
-      case _: ClusteredDistribution | _: HashClusteredDistribution => true
+      case _: ClusteredDistribution | _: HashClusteredDistribution | AllTuples 
=> true

Review comment:
       Actually after a second thought, I think the change here should work. 
For the query like 
https://github.com/apache/spark/pull/33711#discussion_r687173621, the query 
plan when entering this rule, would be:
   
   ```
   HashAggregate(keys=[], functions=[sum(id#41)], output=[sum(id)#45L])
   +- Exchange SinglePartition, ENSURE_REQUIREMENTS, [id=#66]
      +- HashAggregate(keys=[], functions=[partial_sum(id#41)], 
output=[sum#48L])
          +- FileScan
   ```
   
   So the bucket scan will be automatically disabled by the rule, because 
there's a shuffle between `HashAggregate` and `FileScan`.




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