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
9 changes: 0 additions & 9 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ members = [
"vortex-python",
"vortex-tui",
"vortex-test/compat-gen",
"vortex-test/e2e",
"vortex-test/e2e-cuda",
"xtask",
# Encodings
Expand Down Expand Up @@ -292,7 +291,6 @@ vortex-compat = { path = "./vortex-test/compat-gen" }
vortex-cuda = { path = "./vortex-cuda", default-features = false }
vortex-cuda-macros = { path = "./vortex-cuda/macros" }
vortex-duckdb = { path = "./vortex-duckdb", default-features = false }
vortex-test-e2e = { path = "./vortex-test/e2e", default-features = false }
vortex-test-e2e-cuda = { path = "./vortex-test/e2e-cuda", default-features = false }
vortex-tui = { path = "./vortex-tui" }

Expand Down
33 changes: 31 additions & 2 deletions vortex-btrblocks/src/sample.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ pub(crate) fn sample_count_approx_one_percent(len: usize) -> u32 {
)
}

pub fn stratified_slices(
fn stratified_slices(
length: usize,
sample_size: u32,
sample_count: u32,
Expand Down Expand Up @@ -88,7 +88,7 @@ pub fn stratified_slices(

/// Split a range of array indices into as-equal-as-possible slices. If the provided `num_partitions` doesn't
/// evenly divide into `length`, then the first `(length % num_partitions)` slices will have an extra element.
pub fn partition_indices(length: usize, num_partitions: u32) -> Vec<(usize, usize)> {
fn partition_indices(length: usize, num_partitions: u32) -> Vec<(usize, usize)> {
let num_long_parts = length % num_partitions as usize;
let short_step = length / num_partitions as usize;
let long_step = short_step + 1;
Expand All @@ -104,3 +104,32 @@ pub fn partition_indices(length: usize, num_partitions: u32) -> Vec<(usize, usiz
)
.collect()
}

#[cfg(test)]
mod tests {
use vortex_array::IntoArray;
use vortex_array::arrays::PrimitiveArray;
use vortex_array::assert_arrays_eq;
use vortex_array::validity::Validity;
use vortex_buffer::Buffer;
use vortex_error::VortexResult;

use super::*;

#[test]
fn sample_is_deterministic() -> VortexResult<()> {
// Create a deterministic array with linear-with-noise pattern
let values: Vec<i64> = (0i64..100_000).map(|i| i + (i * 7 + 3) % 11).collect();

let array =
PrimitiveArray::new(Buffer::from_iter(values), Validity::NonNullable).into_array();

let first = sample(&array, SAMPLE_SIZE, SAMPLE_COUNT);
for _ in 0..10 {
let again = sample(&array, SAMPLE_SIZE, SAMPLE_COUNT);
assert_eq!(first.nbytes(), again.nbytes());
assert_arrays_eq!(&first, &again);
}
Ok(())
}
}
24 changes: 0 additions & 24 deletions vortex-test/e2e/Cargo.toml

This file was deleted.

58 changes: 0 additions & 58 deletions vortex-test/e2e/src/lib.rs

This file was deleted.

Loading