Kontinuation commented on code in PR #563:
URL: https://github.com/apache/sedona-db/pull/563#discussion_r2748723324


##########
rust/sedona-spatial-join/src/prepare.rs:
##########
@@ -316,6 +292,30 @@ impl SpatialJoinComponentsBuilder {
         Ok(build_partitioner)
     }
 
+    /// Construct a `SpatialPartitioner` (e.g. Flat) from the statistics of 
partitioned build
+    /// side for partitioning the probe side.
+    fn create_spatial_partitioner_for_probe_side(
+        &self,
+        num_partitions: usize,
+        merged_spilled_partitions: &SpilledPartitions,
+    ) -> Result<Arc<dyn SpatialPartitioner>> {
+        let probe_partitioner: Arc<dyn SpatialPartitioner> = {
+            // Build a flat partitioner using these partitions
+            let mut partition_bounds = Vec::with_capacity(num_partitions);
+            for k in 0..num_partitions {
+                let partition = SpatialPartition::Regular(k as u32);
+                let partition_bound = merged_spilled_partitions
+                    .spilled_partition(partition)?
+                    .bounding_box()
+                    .cloned()
+                    .unwrap_or(BoundingBox::empty());
+                partition_bounds.push(partition_bound);
+            }

Review Comment:
   This lookup is very cheap (array index access). I don't see a better way of 
implementing this, and this is not on a performance critical spot, so I'll 
simply leave it as is.



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

Reply via email to