sigmod commented on a change in pull request #35574:
URL: https://github.com/apache/spark/pull/35574#discussion_r812440122



##########
File path: 
sql/core/src/main/scala/org/apache/spark/sql/execution/exchange/EnsureRequirements.scala
##########
@@ -56,7 +57,23 @@ case class EnsureRequirements(
     // Ensure that the operator's children satisfy their output distribution 
requirements.
     var children = originalChildren.zip(requiredChildDistributions).map {
       case (child, distribution) if 
child.outputPartitioning.satisfies(distribution) =>
-        child
+        (child.outputPartitioning, distribution) match {
+          case (p: HashPartitioning, d: ClusteredDistribution) =>
+            if 
(conf.getConf(SQLConf.REQUIRE_ALL_CLUSTER_KEYS_FOR_SOLE_PARTITION) &&
+              requiredChildDistributions.size == 1 && 
!p.isPartitionedOnFullKeys(d)) {
+              // Add an extra shuffle for `ClusteredDistribution` even though 
its child

Review comment:
       Thanks, @c21!
   
   It's probably discussed in the another comment thread.  But I'd like to 
reiterate that although currently it's a global config per a query, the 
examples I mentioned show that it's a physical plan alternative that shouldn't 
be ignored by default. 
   
   The planner eventually probably wants to make a more automatic decision 
between HashClusteredDistribution and ClusteredDistribution at each operator 
level (per heuristics or per stats). By that time, we will still need to bring 
`HashClusteredDistribution` back anyway, regardless how it is named and where 
the dispatch goes (a dedicated class or a bool field in ClusteredDistribution). 
   




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