gene-bordegaray commented on code in PR #23184:
URL: https://github.com/apache/datafusion/pull/23184#discussion_r3486639103


##########
datafusion/physical-expr/src/partitioning.rs:
##########
@@ -596,17 +642,39 @@ pub enum Distribution {
     /// Requires children to be distributed in such a way that the same
     /// values of the keys end up in the same partition
     HashPartitioned(Vec<Arc<dyn PhysicalExpr>>),
+    /// Requires rows with equal values for the given keys to be colocated in
+    /// the same partition, without requiring a specific partitioning 
algorithm.
+    ///
+    /// Unlike [`Self::HashPartitioned`], this can be satisfied by non-hash
+    /// partitioning such as range partitioning. A partitioning on a subset of
+    /// these keys can also satisfy this requirement because rows equal on all
+    /// required keys are also equal on any subset.
+    ///
+    /// For multi-input operators, satisfaction alone is not enough: each input
+    /// may satisfy its own key requirement while using incompatible partition
+    /// boundaries. Use [`Partitioning::co_partitioned_with`] before pairing
+    /// partitions by index.
+    KeyPartitioned(Vec<Arc<dyn PhysicalExpr>>),
 }

Review Comment:
   ya I agree with this long-term 🤔 
   
   What do you think about deprecating `HashPartitioned` then Introducing 
`KeyPartitioned` and lettting this PR be the first real consumer of it. Then we 
don't allow range to satisfy `KeyPartitioned` generally here, and only allow 
range to satisfy the distribution in the partitioend join case.
   
   Then in following PRs we slowly add some provate helpers to allow range to 
satisfay the `KeyPartitioned` like aggregations, then once its at a reasonable 
scope (a good amount of operators are working and tested thoroughly), we and 
range to the general `satisfaction()` public method.
   
   Trying to think how to do this incrementally 



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