Skip to content

Commit

Permalink
feat: generate_random_columns should support the Scalar column type
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobtrombetta committed Dec 3, 2024
1 parent 23d05b1 commit 4b7f2e1
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions crates/proof-of-sql/benches/scaffold/random_util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,21 @@ pub fn generate_random_columns<'a, S: Scalar>(
alloc.alloc_slice_fill_iter(strs.iter().map(|&s| Into::into(s))),
))
}
(ColumnType::Scalar, _) => {
let strs = alloc.alloc_slice_fill_with(num_rows, |_| {
let len = rng
.gen_range(0..=bound.map(|b| b(num_rows) as usize).unwrap_or(10));
alloc.alloc_str(
&rng.sample_iter(&rand::distributions::Alphanumeric)
.take(len)
.map(char::from)
.collect::<String>(),
) as &str
});
Column::Scalar(
alloc.alloc_slice_fill_iter(strs.iter().map(|&s| Into::into(s))),
)
}
_ => todo!(),
},
)
Expand Down

0 comments on commit 4b7f2e1

Please sign in to comment.