Skip to content
Open
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
314 changes: 260 additions & 54 deletions encodings/sparse/src/canonical.rs

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,7 @@ mod tests {

use crate::ArrayRef;
use crate::IntoArray;
use crate::RecursiveCanonical;
use crate::VortexSessionExecute;
use crate::aggregate_fn::Accumulator;
use crate::aggregate_fn::AggregateFnVTable;
Expand Down Expand Up @@ -376,15 +377,26 @@ mod tests {
use crate::scalar::ScalarValue;
use crate::validity::Validity;

/// The size the array occupies once rebuilt through the canonical builders, which is the
/// layout [`UncompressedSizeInBytes`] is defined against: the builders normalize physical
/// widths that the input array is free to choose differently, picking the smallest decimal
/// value type for a precision and `u64` list-view offsets and sizes.
///
/// Builders no longer canonicalize their children, so the finished array is only canonical at
/// the top level - recursively canonicalize it before measuring.
fn materialized_uncompressed_size_in_bytes(array: &ArrayRef) -> u64 {
let mut ctx = array_session().create_execution_ctx();
let mut builder = builder_with_capacity(array.dtype(), array.len());
array
.append_to_builder(
builder.as_mut(),
&mut array_session().create_execution_ctx(),
)
.append_to_builder(builder.as_mut(), &mut ctx)
.vortex_expect("appended");
builder.finish().nbytes()
builder
.finish()
.execute::<RecursiveCanonical>(&mut ctx)
.vortex_expect("recursively canonicalized")
.0
.into_array()
.nbytes()
}

fn aggregate(array: &ArrayRef) -> VortexResult<u64> {
Expand Down
Loading
Loading