Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions rust/sedona-common/src/option.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,13 @@ config_namespace! {

/// Include tie-breakers in KNN join results when there are tied distances
pub knn_include_tie_breakers: bool, default = false

/// The minimum number of geometry pairs per chunk required to enable parallel
/// refinement during the spatial join operation. When the refinement phase has
/// fewer geometry pairs than this threshold, it will run sequentially instead
/// of spawning parallel tasks. Higher values reduce parallelization overhead
/// for small datasets, while lower values enable more fine-grained parallelism.
pub parallel_refinement_chunk_size: usize, default = 8192
}
}

Expand Down
18 changes: 18 additions & 0 deletions rust/sedona-spatial-join/src/exec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1135,6 +1135,24 @@ mod tests {
Ok(())
}

#[tokio::test]
async fn test_parallel_refinement_for_large_candidate_set() -> Result<()> {
let ((left_schema, left_partitions), (right_schema, right_partitions)) =
create_test_data_with_size_range((1.0, 50.0), WKB_GEOMETRY)?;

for max_batch_size in [10, 30, 100] {
let options = SpatialJoinOptions {
execution_mode: ExecutionMode::PrepareNone,
parallel_refinement_chunk_size: 10,
..Default::default()
};
test_spatial_join_query(&left_schema, &right_schema, left_partitions.clone(), right_partitions.clone(), &options, max_batch_size,
"SELECT * FROM L JOIN R ON ST_Intersects(L.geometry, R.geometry) AND L.dist < R.dist ORDER BY L.id, R.id").await?;
}

Ok(())
}

async fn test_with_join_types(join_type: JoinType) -> Result<RecordBatch> {
let ((left_schema, left_partitions), (right_schema, right_partitions)) =
create_test_data_with_empty_partitions()?;
Expand Down
Loading