Skip to content
Merged
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
23 changes: 0 additions & 23 deletions vortex-array/src/scalar_fn/fns/stat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,7 @@ use crate::ArrayRef;
use crate::ExecutionCtx;
use crate::IntoArray;
use crate::aggregate_fn::AggregateFnRef;
use crate::arrays::Chunked;
use crate::arrays::ChunkedArray;
use crate::arrays::ConstantArray;
use crate::arrays::chunked::ChunkedArrayExt;
use crate::dtype::DType;
use crate::expr::Expression;
use crate::expr::stats::StatsProvider;
Expand Down Expand Up @@ -115,26 +112,6 @@ impl ScalarFnVTable for StatFn {
) -> VortexResult<ArrayRef> {
let input = args.get(0)?;
let dtype = stat_dtype(options.aggregate_fn(), input.dtype())?;

// Recurse into each chunk so the output keeps per-chunk granularity (one constant
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I realized we already have a rule that pushes scalar functions through chunked arrays

// per chunk) instead of collapsing to a single combined stat across the whole array.
// Per-chunk granularity is what makes the result useful for pruning: predicates can
// drop whole chunks at a time. Without this, we'd lose every chunk boundary as a
// pruning opportunity. Other encodings (zone maps, etc.) will need similar
// structure-preserving handling once they land.
if let Some(chunked) = input.as_opt::<Chunked>() {
tracing::trace!(
"stat({}) descending into ChunkedArray with {} chunks",
options.aggregate_fn(),
chunked.nchunks()
);
let chunks = chunked
.iter_chunks()
.map(|chunk| stat_array(chunk, options.aggregate_fn(), dtype.clone(), chunk.len()))
.collect::<VortexResult<Vec<_>>>()?;
return Ok(ChunkedArray::try_new(chunks, dtype)?.into_array());
}

stat_array(&input, options.aggregate_fn(), dtype, args.row_count())
}
}
Expand Down
Loading