Skip to content

Commit

Permalink
review 5/n: no need to eagerly merge chunked stats
Browse files Browse the repository at this point in the history
  • Loading branch information
jdcasale committed May 7, 2024
1 parent a762f87 commit 21e2368
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 14 deletions.
14 changes: 1 addition & 13 deletions vortex-array/src/array/chunked/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ use crate::array::primitive::PrimitiveArray;
use crate::compute::scalar_at::scalar_at;
use crate::compute::scalar_subtract::{subtract_scalar, SubtractScalarFn};
use crate::compute::search_sorted::{search_sorted, SearchSortedSide};
use crate::stats::ArrayStatistics;
use crate::validity::Validity::NonNullable;
use crate::validity::{ArrayValidity, LogicalValidity};
use crate::visitor::{AcceptArrayVisitor, ArrayVisitor};
Expand Down Expand Up @@ -47,18 +46,7 @@ impl ChunkedArray<'_> {
let mut children = vec![chunk_ends.into_array_data()];
children.extend(chunks.iter().map(|a| a.to_array_data()));

// NB: this reports whatever stats we can correctly deduce for the top-level logical array
// If we'd prefer not to report stats for non-primitive arrays we can remove this
let merged_stats = chunks
.iter()
.map(|chunk| chunk.statistics().to_set())
.reduce(|mut a, b| {
a.merge(&b);
a
})
.unwrap_or_else(StatsSet::new);

Self::try_from_parts(dtype, ChunkedMetadata, children.into(), merged_stats)
Self::try_from_parts(dtype, ChunkedMetadata, children.into(), StatsSet::new())
}

#[inline]
Expand Down
2 changes: 1 addition & 1 deletion vortex-array/src/view.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ impl<'v> ArrayView<'v> {
child,
&self.buffers[buffer_offset..][0..buffer_count],
)
.unwrap(),
.unwrap(),
)
}

Expand Down

0 comments on commit 21e2368

Please sign in to comment.