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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ coverage.xml
*.cover
*.py,cover
.hypothesis/
# hegeltest's example database, the Rust equivalent of .hypothesis/
.hegel/
.pytest_cache/
cover/

Expand Down
87 changes: 85 additions & 2 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ glob = "0.3.2"
goldenfile = "1"
half = { version = "2.7.1", features = ["std", "num-traits"] }
hashbrown = "0.17.1"
hegeltest = "0.28.7"
http = "1.5.0"
humansize = "2.1.3"
indicatif = "0.18.0"
Expand Down
4 changes: 2 additions & 2 deletions docs/specs/editions.md
Original file line number Diff line number Diff line change
Expand Up @@ -172,9 +172,9 @@ representation gains support for wide decimals, represented by a signed most-sig
represented that way, it emits `vortex.decimal_byte_parts` with `lower_part_count = 0`, even if
the current in-memory array has lower-part children.
- An array that cannot be collapsed into that old form losslessly uses the new
`vortex.decimal_byte_parts_v2` component, initially staged in a draft edition.
`vortex.decimal_byte_parts.v2` component, initially staged in a draft edition.
- A new reader deserializes both IDs into the same in-memory representation. An older reader reports
`vortex.decimal_byte_parts_v2` as unknown instead of trying to decode a wire format it does not support.
`vortex.decimal_byte_parts.v2` as unknown instead of trying to decode a wire format it does not support.
- When targeting an edition that permits only the old ID, serializing a value that can be collapsed succeeds; an
irreducibly multi-part value fails because no lossless downgrade exists.

Expand Down
12 changes: 12 additions & 0 deletions encodings/decimal-byte-parts/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,17 @@ vortex-mask = { workspace = true }
vortex-session = { workspace = true }

[dev-dependencies]
divan = { workspace = true }
hegeltest = { workspace = true }
rand = { workspace = true }
rstest = { workspace = true }
vortex-array = { path = "../../vortex-array", features = ["_test-harness"] }
vortex-bench-support = { workspace = true }

[[bench]]
name = "dbp_assemble"
harness = false

[[bench]]
name = "dbp_split"
harness = false
77 changes: 77 additions & 0 deletions encodings/decimal-byte-parts/benches/common/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: Copyright the Vortex contributors

//! Shared inputs for splitting and assembly benchmarks.

use rand::RngExt;
use rand::SeedableRng;
use rand::rngs::StdRng;
use vortex_array::dtype::DecimalType;
use vortex_array::dtype::i256;
use vortex_buffer::Buffer;

pub(super) fn cases() -> Vec<(DecimalType, usize)> {
[DecimalType::I128, DecimalType::I256]
.into_iter()
.flat_map(|values_type| [1_024, 8_192].map(|len| (values_type, len)))
.collect()
}

pub(super) fn i128_values(len: usize) -> Buffer<i128> {
let mut rng = StdRng::seed_from_u64(42);
let max = 10i128.pow(38) - 1;
(0..len).map(|_| rng.random_range(-max..=max)).collect()
}

pub(super) fn i256_values(len: usize) -> Buffer<i256> {
let mut rng = StdRng::seed_from_u64(42);
// Keep the magnitude below 10^76 while exercising all four signed/unsigned words.
(0..len)
.map(|_| i256::from_parts(rng.random(), rng.random::<i128>() >> 4))
.collect()
}

#[cfg(not(codspeed))]
pub(super) mod arrays {
use rand::RngExt;
use rand::SeedableRng;
use rand::rngs::StdRng;
use vortex_array::arrays::DecimalArray;
use vortex_array::dtype::DecimalDType;
use vortex_array::dtype::DecimalType;
use vortex_array::validity::Validity;
use vortex_buffer::Buffer;
use vortex_error::vortex_panic;

use super::i128_values;
use super::i256_values;

pub(crate) fn cases() -> Vec<(DecimalType, usize)> {
[DecimalType::I64, DecimalType::I128, DecimalType::I256]
.into_iter()
.flat_map(|values_type| [1_024, 8_192].map(|len| (values_type, len)))
.collect()
}

pub(crate) fn decimal_array(
values_type: DecimalType,
len: usize,
validity: Validity,
) -> DecimalArray {
match values_type {
DecimalType::I64 => {
let mut rng = StdRng::seed_from_u64(42);
let max = 10i64.pow(18) - 1;
let values: Buffer<i64> = (0..len).map(|_| rng.random_range(-max..=max)).collect();
DecimalArray::new(values, DecimalDType::new(18, 2), validity)
}
DecimalType::I128 => {
DecimalArray::new(i128_values(len), DecimalDType::new(38, 2), validity)
}
DecimalType::I256 => {
DecimalArray::new(i256_values(len), DecimalDType::new(76, 2), validity)
}
_ => vortex_panic!("unsupported benchmark storage type: {values_type}"),
}
}
}
Loading
Loading