chore(rust/sedona-spatial-join): Make partitioner not sync, create dedicated partitioner for each task#592
Merged
Kontinuation merged 4 commits intoapache:mainfrom Feb 11, 2026
Conversation
…dicated partitioner for each task
Contributor
There was a problem hiding this comment.
Pull request overview
Refactors spatial partitioning to avoid nondeterministic behavior from shared, stateful partitioners by ensuring each task owns its own partitioner instance, and removes the Sync constraint from SpatialPartitioner.
Changes:
- Replaced shared
Arc<dyn SpatialPartitioner>usage with per-taskBox<dyn SpatialPartitioner>cloning via a newbox_clone()trait method. - Updated probe-side stream options to hold a clonable partitioner prototype and create dedicated partitioners per task.
- Refactored partitioner implementations (e.g., RoundRobin, RTree) to support cloning under the new trait contract.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| rust/sedona-spatial-join/src/probe/partitioned_stream_provider.rs | Stores a clonable partitioner prototype and clones per task/stream creation. |
| rust/sedona-spatial-join/src/probe/first_pass_stream.rs | Moves from shared Arc partitioner to owned Box partitioner per stream. |
| rust/sedona-spatial-join/src/prepare.rs | Updates join preparation to pass owned partitioners and clone per spawned task. |
| rust/sedona-spatial-join/src/partitioning/stream_repartitioner.rs | Updates repartitioner to own a Box partitioner and accept cloned instances. |
| rust/sedona-spatial-join/src/partitioning/rtree.rs | Makes RTreePartitioner cheaply cloneable via Arc-backed inner implementation. |
| rust/sedona-spatial-join/src/partitioning/round_robin.rs | Replaces atomic counter with task-local Cell and adds box_clone(). |
| rust/sedona-spatial-join/src/partitioning/kdb.rs | Adds Clone + box_clone() to satisfy new trait API. |
| rust/sedona-spatial-join/src/partitioning/flat.rs | Adds Clone + box_clone() to satisfy new trait API. |
| rust/sedona-spatial-join/src/partitioning/broadcast.rs | Adds Clone + box_clone() to satisfy new trait API. |
| rust/sedona-spatial-join/src/partitioning.rs | Drops Sync bound and adds box_clone() to enable per-task ownership. |
| rust/sedona-spatial-join/bench/partitioning/stream_repartitioner.rs | Updates benchmarks to use Box partitioners and clone per iteration. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
rust/sedona-spatial-join/src/probe/partitioned_stream_provider.rs
Outdated
Show resolved
Hide resolved
rust/sedona-spatial-join/src/probe/partitioned_stream_provider.rs
Outdated
Show resolved
Hide resolved
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
paleolimbot
approved these changes
Feb 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is a follow up of comment #573 (comment). The round robin partitioner uses an internal atomic counter and produces nondeterministic partitioning results due to task scheduling orders. This patch did a large refactoring to make each task own its own partitioner instance, thus eliminates randomness caused by racing. We have also removed the
Syncconstraint from the partitioner trait to enforce this design.