Skip to content

Commit fe12182

Browse files
authored
Stats merging should use the stat dtype and not array dtype (#2919)
1 parent 48bc63a commit fe12182

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

vortex-array/src/stats/traits.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use vortex_dtype::DType;
2-
use vortex_error::{VortexError, vortex_panic};
2+
use vortex_error::{VortexError, VortexExpect, vortex_panic};
33
use vortex_scalar::{Scalar, ScalarValue};
44

55
use super::{Precision, Stat, StatType};
@@ -20,7 +20,10 @@ impl<S> StatsProviderExt for S where S: StatsProvider {}
2020

2121
pub trait StatsProviderExt: StatsProvider {
2222
fn get_scalar(&self, stat: Stat, dtype: &DType) -> Option<Precision<Scalar>> {
23-
self.get(stat).map(|v| v.into_scalar(dtype.clone()))
23+
let stat_dtype = stat
24+
.dtype(dtype)
25+
.vortex_expect("getting scalar for stat dtype");
26+
self.get(stat).map(|v| v.into_scalar(stat_dtype))
2427
}
2528

2629
fn get_scalar_bound<S: StatType<Scalar>>(&self, dtype: &DType) -> Option<S::Bound> {

0 commit comments

Comments
 (0)