Skip to content

Commit

Permalink
chore: Upgrade rand crate and some other minor crates
Browse files Browse the repository at this point in the history
  • Loading branch information
comphead committed Mar 3, 2025
1 parent 54a7ec9 commit 7f69728
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 13 deletions.
11 changes: 3 additions & 8 deletions datafusion/core/benches/data_utils/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,6 @@ pub fn create_table_provider(
MemTable::try_new(schema, partitions).map(Arc::new)
}

/// create a seedable [`StdRng`](rand::StdRng)
fn seedable_rng() -> StdRng {
StdRng::seed_from_u64(42)
}

/// Create test data schema
pub fn create_schema() -> Schema {
Schema::new(vec![
Expand All @@ -72,7 +67,7 @@ pub fn create_schema() -> Schema {

fn create_data(size: usize, null_density: f64) -> Vec<Option<f64>> {
// use random numbers to avoid spurious compiler optimizations wrt to branching
let mut rng = seedable_rng();
let mut rng = StdRng::seed_from_u64(42);

(0..size)
.map(|_| {
Expand All @@ -87,7 +82,7 @@ fn create_data(size: usize, null_density: f64) -> Vec<Option<f64>> {

fn create_integer_data(size: usize, value_density: f64) -> Vec<Option<u64>> {
// use random numbers to avoid spurious compiler optimizations wrt to branching
let mut rng = seedable_rng();
let mut rng = StdRng::seed_from_u64(42);

(0..size)
.map(|_| {
Expand Down Expand Up @@ -148,7 +143,7 @@ pub fn create_record_batches(
partitions_len: usize,
batch_size: usize,
) -> Vec<Vec<RecordBatch>> {
let mut rng = seedable_rng();
let mut rng = StdRng::seed_from_u64(42);
(0..partitions_len)
.map(|_| {
(0..array_len / batch_size / partitions_len)
Expand Down
6 changes: 1 addition & 5 deletions datafusion/functions/benches/ltrim.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,6 @@ use datafusion_functions::string;
use rand::{distr::Alphanumeric, rngs::StdRng, Rng, SeedableRng};
use std::{fmt, sync::Arc};

pub fn seedable_rng() -> StdRng {
StdRng::seed_from_u64(42)
}

#[derive(Clone, Copy)]
pub enum StringArrayType {
Utf8View,
Expand All @@ -58,7 +54,7 @@ pub fn create_string_array_and_characters(
remaining_len: usize,
string_array_type: StringArrayType,
) -> (ArrayRef, ScalarValue) {
let rng = &mut seedable_rng();
let rng = &mut StdRng::seed_from_u64(42);

// Create `size` rows:
// - 10% rows will be `None`
Expand Down

0 comments on commit 7f69728

Please sign in to comment.