Compute which node owns a given partition (based on join key hash). Uses consistent hashing: `partition = hash(key) % num_nodes`. The target node is selected from the routing table's active leaders.
(key: &str, num_partitions: usize)
| 104 | /// Uses consistent hashing: `partition = hash(key) % num_nodes`. |
| 105 | /// The target node is selected from the routing table's active leaders. |
| 106 | pub fn partition_for_key(key: &str, num_partitions: usize) -> u32 { |
| 107 | (crate::routing::fnv1a_hash(key) % num_partitions as u64) as u32 |
| 108 | } |
| 109 | |
| 110 | /// Plan the node assignments for a shuffle join. |
| 111 | /// |