Skip to content

Commit c59a631

Browse files
Quicker check constant check in slice (#3259)
Signed-off-by: Joe Isaacs <[email protected]> --------- Signed-off-by: Joe Isaacs <[email protected]>
1 parent 61149ce commit c59a631

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

vortex-array/src/array/implementation.rs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,12 @@ use crate::array::convert::IntoArray;
1212
use crate::array::operations::ArrayOperationsImpl;
1313
use crate::array::validity::ArrayValidityImpl;
1414
use crate::array::visitor::ArrayVisitorImpl;
15+
use crate::arrays::ConstantEncoding;
1516
use crate::builders::ArrayBuilder;
1617
use crate::compute::{ComputeFn, InvocationArgs, Output};
1718
use crate::stats::{Precision, Stat, StatsProviderExt, StatsSetRef};
18-
use crate::vtable::VTableRef;
19-
use crate::{
20-
Array, ArrayRef, ArrayStatistics, ArrayStatisticsImpl, ArrayVisitor, Canonical, Encoding,
21-
EncodingId,
22-
};
19+
use crate::vtable::{EncodingVTable, VTableRef};
20+
use crate::{Array, ArrayRef, ArrayStatisticsImpl, ArrayVisitor, Canonical, Encoding, EncodingId};
2321

2422
/// A trait used to encapsulate common implementation behaviour for a Vortex [`Array`].
2523
pub trait ArrayImpl:
@@ -115,9 +113,8 @@ impl<A: ArrayImpl + 'static> Array for A {
115113

116114
// We know that constant array don't need stats propagation, so we can avoid the overhead of
117115
// computing derived stats and merging them in.
118-
// TODO(ngates): skip the is_constant check here, it can force an expensive compute.
119116
// TODO(ngates): provide a means to slice an array _without_ propagating stats.
120-
let derived_stats = (!self.is_constant()).then(|| {
117+
let derived_stats = (!self.is_encoding(ConstantEncoding.id())).then(|| {
121118
let stats = self.statistics().to_owned();
122119

123120
// an array that is not constant can become constant after slicing

0 commit comments

Comments
 (0)