-
Notifications
You must be signed in to change notification settings - Fork 43
chore(rust/sedona-spatial-join): use RTree partitioner for probe side when partition count > 48 #598
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Kontinuation
merged 4 commits into
apache:main
from
Kontinuation:support-rtree-partitioner
Feb 13, 2026
Merged
chore(rust/sedona-spatial-join): use RTree partitioner for probe side when partition count > 48 #598
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
464f705
feat(spatial-join): use RTree partitioner for probe side when partiti…
Kontinuation cdb0684
Remove unnecessary build_index.rs
Kontinuation d203bf9
fix(spatial-join): suppress dead_code warning in shared bench helper …
Kontinuation 931a0e4
refactor(spatial-join): move bench helpers to utils::internal_benchma…
Kontinuation File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
86 changes: 86 additions & 0 deletions
86
rust/sedona-spatial-join/bench/partitioning/flat_vs_rtree.rs
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,86 @@ | ||
| // Licensed to the Apache Software Foundation (ASF) under one | ||
| // or more contributor license agreements. See the NOTICE file | ||
| // distributed with this work for additional information | ||
| // regarding copyright ownership. The ASF licenses this file | ||
| // to you under the Apache License, Version 2.0 (the | ||
| // "License"); you may not use this file except in compliance | ||
| // with the License. You may obtain a copy of the License at | ||
| // | ||
| // http://www.apache.org/licenses/LICENSE-2.0 | ||
| // | ||
| // Unless required by applicable law or agreed to in writing, | ||
| // software distributed under the License is distributed on an | ||
| // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| // KIND, either express or implied. See the License for the | ||
| // specific language governing permissions and limitations | ||
| // under the License. | ||
|
|
||
| //! Head-to-head benchmark of FlatPartitioner vs RTreePartitioner across | ||
| //! varying partition counts to find the optimal switch point. | ||
|
|
||
| use std::hint::black_box; | ||
|
|
||
| use criterion::{criterion_group, criterion_main, BenchmarkId, Criterion, Throughput}; | ||
| use sedona_spatial_join::partitioning::{ | ||
| flat::FlatPartitioner, rtree::RTreePartitioner, SpatialPartitioner, | ||
| }; | ||
| use sedona_spatial_join::utils::internal_benchmark_util::{ | ||
| default_extent, grid_partitions, sample_queries, QUERY_BATCH_SIZE, | ||
| }; | ||
|
|
||
| /// Grid dimensions to benchmark. Each produces dim*dim partitions. | ||
| /// 4x4=16, 5x5=25, 6x6=36, 8x8=64, 10x10=100, 16x16=256, 20x20=400 | ||
| const GRID_DIMS: [usize; 7] = [4, 5, 6, 8, 10, 16, 20]; | ||
|
|
||
| fn bench_flat_vs_rtree(c: &mut Criterion) { | ||
| let extent = default_extent(); | ||
|
|
||
| let mut group = c.benchmark_group("flat_vs_rtree"); | ||
| group.throughput(Throughput::Elements(QUERY_BATCH_SIZE as u64)); | ||
|
|
||
| for &dim in &GRID_DIMS { | ||
| let num_partitions = dim * dim; | ||
| let partitions = grid_partitions(&extent, dim); | ||
| let queries = sample_queries(&extent, QUERY_BATCH_SIZE); | ||
|
|
||
| let flat = | ||
| FlatPartitioner::try_new(partitions.clone()).expect("failed to build FlatPartitioner"); | ||
| let rtree = | ||
| RTreePartitioner::try_new(partitions).expect("failed to build RTreePartitioner"); | ||
|
|
||
| group.bench_with_input( | ||
| BenchmarkId::new("flat", num_partitions), | ||
| &flat, | ||
| |b, partitioner| { | ||
| b.iter(|| { | ||
| for query in &queries { | ||
| let result = partitioner | ||
| .partition(black_box(query)) | ||
| .expect("partition failed"); | ||
| black_box(result); | ||
| } | ||
| }); | ||
| }, | ||
| ); | ||
|
|
||
| group.bench_with_input( | ||
| BenchmarkId::new("rtree", num_partitions), | ||
| &rtree, | ||
| |b, partitioner| { | ||
| b.iter(|| { | ||
| for query in &queries { | ||
| let result = partitioner | ||
| .partition(black_box(query)) | ||
| .expect("partition failed"); | ||
| black_box(result); | ||
| } | ||
| }); | ||
| }, | ||
| ); | ||
| } | ||
|
|
||
| group.finish(); | ||
| } | ||
|
|
||
| criterion_group!(flat_vs_rtree, bench_flat_vs_rtree); | ||
| criterion_main!(flat_vs_rtree); | ||
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
This file was deleted.
Oops, something went wrong.
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
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
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
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.
Uh oh!
There was an error while loading. Please reload this page.