Skip to content

Commit 740e2df

Browse files
committed
fix
Signed-off-by: Adam Gutglick <adam@spiraldb.com>
1 parent dc02c7d commit 740e2df

1 file changed

Lines changed: 24 additions & 34 deletions

File tree

  • vortex-array/src/scalar_fn/fns

vortex-array/src/scalar_fn/fns/stat.rs

Lines changed: 24 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -142,44 +142,34 @@ fn stat_array(
142142
) -> VortexResult<ArrayRef> {
143143
let value = if aggregate_fn.is::<AllNull>() {
144144
let len = u64::try_from(len)?;
145-
array
146-
.statistics()
147-
.get_as::<u64>(Stat::NullCount)
148-
.and_then(|null_count| match null_count {
149-
Precision::Exact(count) => Some(count == len),
150-
Precision::Inexact(count) => (count < len).then_some(false),
151-
})
152-
.map(ScalarValue::Bool)
145+
match array.statistics().get_as::<u64>(Stat::NullCount) {
146+
Precision::Exact(count) => Some(count == len),
147+
Precision::Inexact(count) => (count < len).then_some(false),
148+
Precision::Absent => None,
149+
}
150+
.map(ScalarValue::Bool)
153151
} else if aggregate_fn.is::<AllNonNull>() {
154-
array
155-
.statistics()
156-
.get_as::<u64>(Stat::NullCount)
157-
.and_then(|null_count| match null_count {
158-
Precision::Exact(count) => Some(count == 0),
159-
Precision::Inexact(0) => Some(true),
160-
Precision::Inexact(_) => None,
161-
})
162-
.map(ScalarValue::Bool)
152+
match array.statistics().get_as::<u64>(Stat::NullCount) {
153+
Precision::Exact(count) => Some(count == 0),
154+
Precision::Inexact(0) => Some(true),
155+
Precision::Inexact(_) | Precision::Absent => None,
156+
}
157+
.map(ScalarValue::Bool)
163158
} else if aggregate_fn.is::<AllNan>() {
164159
let len = u64::try_from(len)?;
165-
array
166-
.statistics()
167-
.get_as::<u64>(Stat::NaNCount)
168-
.and_then(|nan_count| match nan_count {
169-
Precision::Exact(count) => Some(count == len),
170-
Precision::Inexact(count) => (count < len).then_some(false),
171-
})
172-
.map(ScalarValue::Bool)
160+
match array.statistics().get_as::<u64>(Stat::NaNCount) {
161+
Precision::Exact(count) => Some(count == len),
162+
Precision::Inexact(count) => (count < len).then_some(false),
163+
Precision::Absent => None,
164+
}
165+
.map(ScalarValue::Bool)
173166
} else if aggregate_fn.is::<AllNonNan>() {
174-
array
175-
.statistics()
176-
.get_as::<u64>(Stat::NaNCount)
177-
.and_then(|nan_count| match nan_count {
178-
Precision::Exact(count) => Some(count == 0),
179-
Precision::Inexact(0) => Some(true),
180-
Precision::Inexact(_) => None,
181-
})
182-
.map(ScalarValue::Bool)
167+
match array.statistics().get_as::<u64>(Stat::NaNCount) {
168+
Precision::Exact(count) => Some(count == 0),
169+
Precision::Inexact(0) => Some(true),
170+
Precision::Inexact(_) | Precision::Absent => None,
171+
}
172+
.map(ScalarValue::Bool)
183173
} else if let Some(stat) = Stat::from_aggregate_fn(aggregate_fn) {
184174
array
185175
.statistics()

0 commit comments

Comments
 (0)