diff --git a/vortex-ipc/src/messages.rs b/vortex-ipc/src/messages.rs index 1ac67ee71b..7b5fac5856 100644 --- a/vortex-ipc/src/messages.rs +++ b/vortex-ipc/src/messages.rs @@ -208,6 +208,7 @@ impl<'a> WriteFlatBuffer for IPCArray<'a> { } } +/// Computes all stats and uses the results to create an ArrayStats table for the flatbuffer message fn compute_and_build_stats<'a>( fbb: &'_ mut FlatBufferBuilder<'a>, array: &'_ ArrayData, diff --git a/vortex-ipc/src/reader.rs b/vortex-ipc/src/reader.rs index cca1d6e95d..2c7d30c801 100644 --- a/vortex-ipc/src/reader.rs +++ b/vortex-ipc/src/reader.rs @@ -479,6 +479,12 @@ mod tests { let data = PrimitiveArray::from((0i32..3_000_000).collect_vec()).into_array(); let data = round_trip(&data); + // NB: data is an ArrayData constructed from the result of calling read_array on an array + // reader. read_array calls to_static on the underlying chunks, which translates them + // from Array to Array, and in that translation, it calls to_set + // in the ArrayView's statistics. Thus, to check that we get correct behavior from + // ArrayView statistics get() and to_set() methods, we call get (but not compute!) + // on the result for each of the desired statistics verify_stats(&data); let run_count: u64 = data.statistics().get_as::(Stat::RunCount).unwrap();