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
234 changes: 218 additions & 16 deletions Cargo.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ parquet = { version = "57.0.0", default-features = false, features = [
"async",
"object_store",
] }
rand = "0.9"
rand = "0.10"
regex = "1.12"
rstest = "0.26.1"
serde = { version = "1" }
Expand Down
4 changes: 2 additions & 2 deletions rust/sedona-spatial-join/bench/partitioning/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

//! Shared helpers for partitioner benchmarks.

use rand::{rngs::StdRng, Rng, SeedableRng};
use rand::{rngs::StdRng, RngExt, SeedableRng};
use sedona_geometry::{bounding_box::BoundingBox, interval::IntervalTrait};

pub const GRID_DIM: usize = 4; // 4x4 grid => 16 partitions like typical workloads
Expand Down Expand Up @@ -66,7 +66,7 @@ pub fn sample_queries(extent: &BoundingBox, batch_size: usize) -> Vec<BoundingBo
.collect()
}

fn random_bbox(extent: &BoundingBox, rng: &mut StdRng, max_span: f64) -> BoundingBox {
fn random_bbox(extent: &BoundingBox, rng: &mut impl RngExt, max_span: f64) -> BoundingBox {
let (min_x, max_x) = (extent.x().lo(), extent.x().hi());
let (min_y, max_y) = (extent.y().lo(), extent.y().hi());

Expand Down
4 changes: 2 additions & 2 deletions rust/sedona-spatial-join/bench/partitioning/kdb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
use std::hint::black_box;

use criterion::{criterion_group, criterion_main, BenchmarkId, Criterion, Throughput};
use rand::{rngs::StdRng, Rng, SeedableRng};
use rand::{rngs::StdRng, RngExt, SeedableRng};
use sedona_geometry::{bounding_box::BoundingBox, interval::IntervalTrait};
use sedona_spatial_join::partitioning::{kdb::KDBPartitioner, SpatialPartitioner};

Expand Down Expand Up @@ -102,7 +102,7 @@ fn synthetic_bboxes(
boxes
}

fn random_bbox(extent: &BoundingBox, rng: &mut StdRng, max_span: f64) -> BoundingBox {
fn random_bbox(extent: &BoundingBox, rng: &mut impl RngExt, max_span: f64) -> BoundingBox {
let (min_x, max_x) = (extent.x().lo(), extent.x().hi());
let (min_y, max_y) = (extent.y().lo(), extent.y().hi());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ use datafusion::config::SpillCompression;
use datafusion_execution::runtime_env::RuntimeEnv;
use datafusion_physical_plan::metrics::{ExecutionPlanMetricsSet, SpillMetrics};
use futures::executor::block_on;
use rand::{rngs::StdRng, Rng, SeedableRng};
use rand::{rngs::StdRng, RngExt, SeedableRng};
use sedona_geometry::{bounding_box::BoundingBox, interval::IntervalTrait, wkb_factory::wkb_point};
use sedona_schema::datatypes::WKB_GEOMETRY;
use sedona_spatial_join::evaluated_batch::{
Expand Down Expand Up @@ -133,7 +133,7 @@ fn random_evaluated_batch(
EvaluatedBatch { batch, geom_array }
}

fn random_record_batch(schema: Arc<Schema>, rows: usize, rng: &mut StdRng) -> RecordBatch {
fn random_record_batch(schema: Arc<Schema>, rows: usize, rng: &mut impl RngExt) -> RecordBatch {
let ids = Int64Array::from_iter_values((0..rows).map(|_| rng.random_range(0..1_000_000_i64)));
let words = StringArray::from_iter_values((0..rows).map(|_| random_string(rng)));
let dates = Date32Array::from_iter_values((0..rows).map(|_| rng.random_range(18_000..20_000)));
Expand All @@ -151,7 +151,7 @@ fn random_record_batch(schema: Arc<Schema>, rows: usize, rng: &mut StdRng) -> Re
RecordBatch::try_new(schema, columns).expect("record batch assembly should succeed")
}

fn random_geometry_array(rows: usize, extent: &BoundingBox, rng: &mut StdRng) -> ArrayRef {
fn random_geometry_array(rows: usize, extent: &BoundingBox, rng: &mut impl RngExt) -> ArrayRef {
let wkbs: Vec<Vec<u8>> = (0..rows)
.map(|_| {
let x = rng.random_range(extent.x().lo()..=extent.x().hi());
Expand All @@ -164,7 +164,7 @@ fn random_geometry_array(rows: usize, extent: &BoundingBox, rng: &mut StdRng) ->
Arc::new(binary)
}

fn random_string(rng: &mut StdRng) -> String {
fn random_string(rng: &mut impl RngExt) -> String {
const CHARSET: &[u8] = b"abcdefghijklmnopqrstuvwxyz";
let mut buf = [0u8; 8];
for slot in &mut buf {
Expand Down Expand Up @@ -204,7 +204,7 @@ fn build_partitioner(extent: &BoundingBox) -> Arc<dyn SpatialPartitioner + Send
Arc::new(partitioner)
}

fn random_bbox(extent: &BoundingBox, rng: &mut StdRng) -> BoundingBox {
fn random_bbox(extent: &BoundingBox, rng: &mut impl RngExt) -> BoundingBox {
let span_x = (extent.x().hi() - extent.x().lo()) / 20.0;
let span_y = (extent.y().hi() - extent.y().lo()) / 20.0;
let width = rng.random_range(10.0..=span_x).max(1.0);
Expand Down
2 changes: 1 addition & 1 deletion rust/sedona-spatial-join/src/stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1581,7 +1581,7 @@ mod tests {
use arrow::datatypes::{DataType, Field, Schema};
use arrow_array::cast::AsArray;
use rand::rngs::StdRng;
use rand::{Rng, SeedableRng};
use rand::{RngExt, SeedableRng};

fn create_test_batches(
num_batches: usize,
Expand Down
2 changes: 1 addition & 1 deletion rust/sedona-spatial-join/src/utils/bbox_sampler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ impl BoundingBoxSamples {
mod tests {
use super::*;
use rand::rngs::StdRng;
use rand::{Rng, SeedableRng};
use rand::{RngExt, SeedableRng};
use sedona_geometry::interval::IntervalTrait;
use std::mem::size_of;

Expand Down
2 changes: 1 addition & 1 deletion rust/sedona-testing/src/benchmark_util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ use arrow_schema::DataType;
use datafusion_common::{exec_datafusion_err, Result, ScalarValue};
use datafusion_expr::{AggregateUDF, ScalarUDF};
use geo_types::Rect;
use rand::{distr::Uniform, rngs::StdRng, Rng, SeedableRng};
use rand::{distr::Uniform, rngs::StdRng, Rng, RngExt, SeedableRng};

use sedona_common::sedona_internal_err;
use sedona_geometry::types::GeometryTypeId;
Expand Down
2 changes: 1 addition & 1 deletion rust/sedona-testing/src/datagen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ use geo_types::{
Coord, Geometry, GeometryCollection, LineString, MultiLineString, MultiPoint, MultiPolygon,
Point, Polygon, Rect,
};
use rand::{distr::Uniform, rngs::StdRng, Rng, SeedableRng};
use rand::{distr::Uniform, rngs::StdRng, Rng, RngExt, SeedableRng};
use sedona_common::sedona_internal_err;
use sedona_geometry::types::GeometryTypeId;
use sedona_schema::datatypes::{SedonaType, WKB_GEOMETRY};
Expand Down