Skip to content

Commit ae19fe7

Browse files
authored
Explicit Precision::Absent variant instead of Option<Precision> (#8042)
This PR adds a new `Precision::Absent` variant **only after serialization** because its a more idiomatic API. The serialization format is unchanged. --------- Signed-off-by: Adam Gutglick <adam@spiraldb.com>
1 parent 7dace0d commit ae19fe7

47 files changed

Lines changed: 535 additions & 577 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

encodings/datetime-parts/src/compute/take.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ fn take_datetime_parts(
6565
.seconds()
6666
.statistics()
6767
.get(Stat::Min)
68-
.map(|s| s.into_inner())
68+
.into_inner()
6969
.unwrap_or_else(|| Scalar::primitive(0i64, Nullability::NonNullable))
7070
.cast(array.seconds().dtype())?;
7171
let taken_seconds = taken_seconds.fill_null(seconds_fill)?;
@@ -74,7 +74,7 @@ fn take_datetime_parts(
7474
.subseconds()
7575
.statistics()
7676
.get(Stat::Min)
77-
.map(|s| s.into_inner())
77+
.into_inner()
7878
.unwrap_or_else(|| Scalar::primitive(0i64, Nullability::NonNullable))
7979
.cast(array.subseconds().dtype())?;
8080
let taken_subseconds = taken_subseconds.fill_null(subseconds_fill)?;

encodings/sequence/src/array.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -519,12 +519,12 @@ mod tests {
519519
let is_sorted = arr
520520
.statistics()
521521
.with_typed_stats_set(|s| s.get_as::<bool>(Stat::IsSorted));
522-
assert_eq!(is_sorted, Some(StatPrecision::Exact(true)));
522+
assert_eq!(is_sorted, StatPrecision::Exact(true));
523523

524524
let is_strict_sorted = arr
525525
.statistics()
526526
.with_typed_stats_set(|s| s.get_as::<bool>(Stat::IsStrictSorted));
527-
assert_eq!(is_strict_sorted, Some(StatPrecision::Exact(true)));
527+
assert_eq!(is_strict_sorted, StatPrecision::Exact(true));
528528
Ok(())
529529
}
530530

@@ -535,12 +535,12 @@ mod tests {
535535
let is_sorted = arr
536536
.statistics()
537537
.with_typed_stats_set(|s| s.get_as::<bool>(Stat::IsSorted));
538-
assert_eq!(is_sorted, Some(StatPrecision::Exact(true)));
538+
assert_eq!(is_sorted, StatPrecision::Exact(true));
539539

540540
let is_strict_sorted = arr
541541
.statistics()
542542
.with_typed_stats_set(|s| s.get_as::<bool>(Stat::IsStrictSorted));
543-
assert_eq!(is_strict_sorted, Some(StatPrecision::Exact(false)));
543+
assert_eq!(is_strict_sorted, StatPrecision::Exact(false));
544544
Ok(())
545545
}
546546

@@ -551,12 +551,12 @@ mod tests {
551551
let is_sorted = arr
552552
.statistics()
553553
.with_typed_stats_set(|s| s.get_as::<bool>(Stat::IsSorted));
554-
assert_eq!(is_sorted, Some(StatPrecision::Exact(false)));
554+
assert_eq!(is_sorted, StatPrecision::Exact(false));
555555

556556
let is_strict_sorted = arr
557557
.statistics()
558558
.with_typed_stats_set(|s| s.get_as::<bool>(Stat::IsStrictSorted));
559-
assert_eq!(is_strict_sorted, Some(StatPrecision::Exact(false)));
559+
assert_eq!(is_strict_sorted, StatPrecision::Exact(false));
560560
Ok(())
561561
}
562562

@@ -575,8 +575,8 @@ mod tests {
575575
.statistics()
576576
.with_typed_stats_set(|s| s.get_as::<bool>(Stat::IsStrictSorted));
577577

578-
assert_eq!(is_sorted, Some(StatPrecision::Exact(true)));
579-
assert_eq!(is_strict_sorted, Some(StatPrecision::Exact(true)));
578+
assert_eq!(is_sorted, StatPrecision::Exact(true));
579+
assert_eq!(is_strict_sorted, StatPrecision::Exact(true));
580580

581581
Ok(())
582582
}

encodings/zstd/src/zstd_buffers.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -563,7 +563,7 @@ mod tests {
563563

564564
let compressed = ZstdBuffers::compress(&input, 3, &LEGACY_SESSION)?;
565565

566-
assert!(compressed.statistics().get(Stat::Min).is_some());
566+
assert!(!compressed.statistics().get(Stat::Min).is_absent());
567567
Ok(())
568568
}
569569

java/vortex-jni/src/main/java/dev/vortex/api/DataSource.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ public Schema arrowSchema(BufferAllocator allocator) {
8080
}
8181

8282
/**
83-
* Row count along with the precision of that estimate. Mirrors the Rust {@code Option<Precision<u64>>} returned by
83+
* Row count along with the precision of that estimate. Mirrors the Rust {@code Precision<u64>} returned by
8484
* {@code DataSource::row_count}: {@link RowCount.Unknown} when no estimate is available, {@link RowCount.Estimate}
8585
* for an inexact hint, {@link RowCount.Exact} when the count is authoritative.
8686
*/

vortex-array/public-api.lock

Lines changed: 28 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -12964,7 +12964,7 @@ pub mod vortex_array::expr::stats
1296412964

1296512965
pub enum vortex_array::expr::stats::IntersectionResult<T>
1296612966

12967-
pub vortex_array::expr::stats::IntersectionResult::None
12967+
pub vortex_array::expr::stats::IntersectionResult::Empty
1296812968

1296912969
pub vortex_array::expr::stats::IntersectionResult::Value(T)
1297012970

@@ -12990,6 +12990,8 @@ impl<T> core::marker::StructuralPartialEq for vortex_array::expr::stats::Interse
1299012990

1299112991
pub enum vortex_array::expr::stats::Precision<T>
1299212992

12993+
pub vortex_array::expr::stats::Precision::Absent
12994+
1299312995
pub vortex_array::expr::stats::Precision::Exact(T)
1299412996

1299512997
pub vortex_array::expr::stats::Precision::Inexact(T)
@@ -13002,12 +13004,18 @@ impl vortex_array::expr::stats::Precision<vortex_array::scalar::ScalarValue>
1300213004

1300313005
pub fn vortex_array::expr::stats::Precision<vortex_array::scalar::ScalarValue>::into_scalar(self, vortex_array::dtype::DType) -> vortex_array::expr::stats::Precision<vortex_array::scalar::Scalar>
1300413006

13007+
impl<T, E> vortex_array::expr::stats::Precision<core::result::Result<T, E>>
13008+
13009+
pub fn vortex_array::expr::stats::Precision<core::result::Result<T, E>>::transpose(self) -> core::result::Result<vortex_array::expr::stats::Precision<T>, E>
13010+
1300513011
impl<T> vortex_array::expr::stats::Precision<T> where T: core::marker::Copy
1300613012

1300713013
pub fn vortex_array::expr::stats::Precision<T>::to_inexact(&self) -> Self
1300813014

1300913015
impl<T> vortex_array::expr::stats::Precision<T>
1301013016

13017+
pub fn vortex_array::expr::stats::Precision<T>::and_then<U, F: core::ops::function::FnOnce(T) -> core::option::Option<U>>(self, F) -> vortex_array::expr::stats::Precision<U>
13018+
1301113019
pub fn vortex_array::expr::stats::Precision<T>::as_exact(self) -> core::option::Option<T>
1301213020

1301313021
pub fn vortex_array::expr::stats::Precision<T>::as_inexact(self) -> core::option::Option<T>
@@ -13020,23 +13028,19 @@ pub fn vortex_array::expr::stats::Precision<T>::inexact<S: core::convert::Into<T
1302013028

1302113029
pub fn vortex_array::expr::stats::Precision<T>::into_inexact(self) -> Self
1302213030

13023-
pub fn vortex_array::expr::stats::Precision<T>::into_inner(self) -> T
13031+
pub fn vortex_array::expr::stats::Precision<T>::into_inner(self) -> core::option::Option<T>
13032+
13033+
pub fn vortex_array::expr::stats::Precision<T>::is_absent(&self) -> bool
1302413034

1302513035
pub fn vortex_array::expr::stats::Precision<T>::is_exact(&self) -> bool
1302613036

1302713037
pub fn vortex_array::expr::stats::Precision<T>::map<U, F: core::ops::function::FnOnce(T) -> U>(self, F) -> vortex_array::expr::stats::Precision<U>
1302813038

13029-
pub fn vortex_array::expr::stats::Precision<T>::try_map<U, F: core::ops::function::FnOnce(T) -> vortex_error::VortexResult<U>>(self, F) -> vortex_error::VortexResult<vortex_array::expr::stats::Precision<U>>
13030-
1303113039
pub fn vortex_array::expr::stats::Precision<T>::zip<U>(self, vortex_array::expr::stats::Precision<U>) -> vortex_array::expr::stats::Precision<(T, U)>
1303213040

1303313041
impl<T> vortex_array::expr::stats::Precision<T>
1303413042

13035-
pub fn vortex_array::expr::stats::Precision<T>::bound<S: vortex_array::expr::stats::StatType<T>>(self) -> <S as vortex_array::expr::stats::StatType>::Bound
13036-
13037-
impl<T> vortex_array::expr::stats::Precision<core::option::Option<T>>
13038-
13039-
pub fn vortex_array::expr::stats::Precision<core::option::Option<T>>::transpose(self) -> core::option::Option<vortex_array::expr::stats::Precision<T>>
13043+
pub fn vortex_array::expr::stats::Precision<T>::bound<S: vortex_array::expr::stats::StatType<T>>(self) -> core::option::Option<<S as vortex_array::expr::stats::StatType>::Bound>
1304013044

1304113045
impl<T: core::clone::Clone> core::clone::Clone for vortex_array::expr::stats::Precision<T>
1304213046

@@ -13074,6 +13078,10 @@ pub fn vortex_array::expr::stats::Precision<T>::fmt(&self, &mut core::fmt::Forma
1307413078

1307513079
impl<T: core::marker::Copy> core::marker::Copy for vortex_array::expr::stats::Precision<T>
1307613080

13081+
impl<T> core::default::Default for vortex_array::expr::stats::Precision<T>
13082+
13083+
pub fn vortex_array::expr::stats::Precision<T>::default() -> vortex_array::expr::stats::Precision<T>
13084+
1307713085
impl<T> core::marker::StructuralPartialEq for vortex_array::expr::stats::Precision<T>
1307813086

1307913087
#[repr(u8)] pub enum vortex_array::expr::stats::Stat
@@ -13440,47 +13448,47 @@ pub const vortex_array::expr::stats::UncompressedSizeInBytes::STAT: vortex_array
1344013448

1344113449
pub trait vortex_array::expr::stats::StatsProvider
1344213450

13443-
pub fn vortex_array::expr::stats::StatsProvider::get(&self, vortex_array::expr::stats::Stat) -> core::option::Option<vortex_array::expr::stats::Precision<vortex_array::scalar::Scalar>>
13451+
pub fn vortex_array::expr::stats::StatsProvider::get(&self, vortex_array::expr::stats::Stat) -> vortex_array::expr::stats::Precision<vortex_array::scalar::Scalar>
1344413452

1344513453
pub fn vortex_array::expr::stats::StatsProvider::is_empty(&self) -> bool
1344613454

1344713455
pub fn vortex_array::expr::stats::StatsProvider::len(&self) -> usize
1344813456

1344913457
impl vortex_array::expr::stats::StatsProvider for vortex_array::stats::MutTypedStatsSetRef<'_, '_>
1345013458

13451-
pub fn vortex_array::stats::MutTypedStatsSetRef<'_, '_>::get(&self, vortex_array::expr::stats::Stat) -> core::option::Option<vortex_array::expr::stats::Precision<vortex_array::scalar::Scalar>>
13459+
pub fn vortex_array::stats::MutTypedStatsSetRef<'_, '_>::get(&self, vortex_array::expr::stats::Stat) -> vortex_array::expr::stats::Precision<vortex_array::scalar::Scalar>
1345213460

1345313461
pub fn vortex_array::stats::MutTypedStatsSetRef<'_, '_>::is_empty(&self) -> bool
1345413462

1345513463
pub fn vortex_array::stats::MutTypedStatsSetRef<'_, '_>::len(&self) -> usize
1345613464

1345713465
impl vortex_array::expr::stats::StatsProvider for vortex_array::stats::StatsSetRef<'_>
1345813466

13459-
pub fn vortex_array::stats::StatsSetRef<'_>::get(&self, vortex_array::expr::stats::Stat) -> core::option::Option<vortex_array::expr::stats::Precision<vortex_array::scalar::Scalar>>
13467+
pub fn vortex_array::stats::StatsSetRef<'_>::get(&self, vortex_array::expr::stats::Stat) -> vortex_array::expr::stats::Precision<vortex_array::scalar::Scalar>
1346013468

1346113469
pub fn vortex_array::stats::StatsSetRef<'_>::is_empty(&self) -> bool
1346213470

1346313471
pub fn vortex_array::stats::StatsSetRef<'_>::len(&self) -> usize
1346413472

1346513473
impl vortex_array::expr::stats::StatsProvider for vortex_array::stats::TypedStatsSetRef<'_, '_>
1346613474

13467-
pub fn vortex_array::stats::TypedStatsSetRef<'_, '_>::get(&self, vortex_array::expr::stats::Stat) -> core::option::Option<vortex_array::expr::stats::Precision<vortex_array::scalar::Scalar>>
13475+
pub fn vortex_array::stats::TypedStatsSetRef<'_, '_>::get(&self, vortex_array::expr::stats::Stat) -> vortex_array::expr::stats::Precision<vortex_array::scalar::Scalar>
1346813476

1346913477
pub fn vortex_array::stats::TypedStatsSetRef<'_, '_>::is_empty(&self) -> bool
1347013478

1347113479
pub fn vortex_array::stats::TypedStatsSetRef<'_, '_>::len(&self) -> usize
1347213480

1347313481
pub trait vortex_array::expr::stats::StatsProviderExt: vortex_array::expr::stats::StatsProvider
1347413482

13475-
pub fn vortex_array::expr::stats::StatsProviderExt::get_as<T: for<'a> core::convert::TryFrom<&'a vortex_array::scalar::Scalar, Error = vortex_error::VortexError>>(&self, vortex_array::expr::stats::Stat) -> core::option::Option<vortex_array::expr::stats::Precision<T>>
13483+
pub fn vortex_array::expr::stats::StatsProviderExt::get_as<T: for<'a> core::convert::TryFrom<&'a vortex_array::scalar::Scalar, Error = vortex_error::VortexError>>(&self, vortex_array::expr::stats::Stat) -> vortex_array::expr::stats::Precision<T>
1347613484

1347713485
pub fn vortex_array::expr::stats::StatsProviderExt::get_as_bound<S, U>(&self) -> core::option::Option<<S as vortex_array::expr::stats::StatType>::Bound> where S: vortex_array::expr::stats::StatType<U>, U: for<'a> core::convert::TryFrom<&'a vortex_array::scalar::Scalar, Error = vortex_error::VortexError>
1347813486

1347913487
pub fn vortex_array::expr::stats::StatsProviderExt::get_scalar_bound<S: vortex_array::expr::stats::StatType<vortex_array::scalar::Scalar>>(&self) -> core::option::Option<<S as vortex_array::expr::stats::StatType>::Bound>
1348013488

1348113489
impl<S> vortex_array::expr::stats::StatsProviderExt for S where S: vortex_array::expr::stats::StatsProvider
1348213490

13483-
pub fn S::get_as<T: for<'a> core::convert::TryFrom<&'a vortex_array::scalar::Scalar, Error = vortex_error::VortexError>>(&self, vortex_array::expr::stats::Stat) -> core::option::Option<vortex_array::expr::stats::Precision<T>>
13491+
pub fn S::get_as<T: for<'a> core::convert::TryFrom<&'a vortex_array::scalar::Scalar, Error = vortex_error::VortexError>>(&self, vortex_array::expr::stats::Stat) -> vortex_array::expr::stats::Precision<T>
1348413492

1348513493
pub fn S::get_as_bound<S, U>(&self) -> core::option::Option<<S as vortex_array::expr::stats::StatType>::Bound> where S: vortex_array::expr::stats::StatType<U>, U: for<'a> core::convert::TryFrom<&'a vortex_array::scalar::Scalar, Error = vortex_error::VortexError>
1348613494

@@ -21130,7 +21138,7 @@ pub fn vortex_array::stats::MutTypedStatsSetRef<'_, '_>::merge_unordered(self, &
2113021138

2113121139
impl vortex_array::expr::stats::StatsProvider for vortex_array::stats::MutTypedStatsSetRef<'_, '_>
2113221140

21133-
pub fn vortex_array::stats::MutTypedStatsSetRef<'_, '_>::get(&self, vortex_array::expr::stats::Stat) -> core::option::Option<vortex_array::expr::stats::Precision<vortex_array::scalar::Scalar>>
21141+
pub fn vortex_array::stats::MutTypedStatsSetRef<'_, '_>::get(&self, vortex_array::expr::stats::Stat) -> vortex_array::expr::stats::Precision<vortex_array::scalar::Scalar>
2113421142

2113521143
pub fn vortex_array::stats::MutTypedStatsSetRef<'_, '_>::is_empty(&self) -> bool
2113621144

@@ -21168,9 +21176,9 @@ impl vortex_array::stats::StatsSet
2116821176

2116921177
pub fn vortex_array::stats::StatsSet::clear(&mut self, vortex_array::expr::stats::Stat)
2117021178

21171-
pub fn vortex_array::stats::StatsSet::get(&self, vortex_array::expr::stats::Stat) -> core::option::Option<vortex_array::expr::stats::Precision<vortex_array::scalar::ScalarValue>>
21179+
pub fn vortex_array::stats::StatsSet::get(&self, vortex_array::expr::stats::Stat) -> vortex_array::expr::stats::Precision<vortex_array::scalar::ScalarValue>
2117221180

21173-
pub fn vortex_array::stats::StatsSet::get_as<T: for<'a> core::convert::TryFrom<&'a vortex_array::scalar::Scalar, Error = vortex_error::VortexError>>(&self, vortex_array::expr::stats::Stat, &vortex_array::dtype::DType) -> core::option::Option<vortex_array::expr::stats::Precision<T>>
21181+
pub fn vortex_array::stats::StatsSet::get_as<T: for<'a> core::convert::TryFrom<&'a vortex_array::scalar::Scalar, Error = vortex_error::VortexError>>(&self, vortex_array::expr::stats::Stat, &vortex_array::dtype::DType) -> vortex_array::expr::stats::Precision<T>
2117421182

2117521183
pub fn vortex_array::stats::StatsSet::is_empty(&self) -> bool
2117621184

@@ -21292,7 +21300,7 @@ pub fn vortex_array::stats::StatsSetRef<'_>::with_typed_stats_set<U, F: core::op
2129221300

2129321301
impl vortex_array::expr::stats::StatsProvider for vortex_array::stats::StatsSetRef<'_>
2129421302

21295-
pub fn vortex_array::stats::StatsSetRef<'_>::get(&self, vortex_array::expr::stats::Stat) -> core::option::Option<vortex_array::expr::stats::Precision<vortex_array::scalar::Scalar>>
21303+
pub fn vortex_array::stats::StatsSetRef<'_>::get(&self, vortex_array::expr::stats::Stat) -> vortex_array::expr::stats::Precision<vortex_array::scalar::Scalar>
2129621304

2129721305
pub fn vortex_array::stats::StatsSetRef<'_>::is_empty(&self) -> bool
2129821306

@@ -21312,7 +21320,7 @@ pub vortex_array::stats::TypedStatsSetRef::values: &'a vortex_array::stats::Stat
2131221320

2131321321
impl vortex_array::expr::stats::StatsProvider for vortex_array::stats::TypedStatsSetRef<'_, '_>
2131421322

21315-
pub fn vortex_array::stats::TypedStatsSetRef<'_, '_>::get(&self, vortex_array::expr::stats::Stat) -> core::option::Option<vortex_array::expr::stats::Precision<vortex_array::scalar::Scalar>>
21323+
pub fn vortex_array::stats::TypedStatsSetRef<'_, '_>::get(&self, vortex_array::expr::stats::Stat) -> vortex_array::expr::stats::Precision<vortex_array::scalar::Scalar>
2131621324

2131721325
pub fn vortex_array::stats::TypedStatsSetRef<'_, '_>::is_empty(&self) -> bool
2131821326

vortex-array/src/aggregate_fn/accumulator.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ impl<V: AggregateFnVTable> DynAccumulator for Accumulator<V> {
122122
// 0. Legacy stats bridge: if this aggregate is still cached under a legacy Stat slot,
123123
// consume that exact stat before kernel dispatch or decode.
124124
if let Some(stat) = Stat::from_aggregate_fn(&self.aggregate_fn)
125-
&& let Some(Precision::Exact(partial)) = batch.statistics().get(stat)
125+
&& let Precision::Exact(partial) = batch.statistics().get(stat)
126126
{
127127
let partial = if partial.dtype() == &self.partial_dtype {
128128
partial

vortex-array/src/aggregate_fn/fns/is_constant/mod.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ fn arrays_value_equal(a: &ArrayRef, b: &ArrayRef, ctx: &mut ExecutionCtx) -> Vor
8989
/// 5. Is all valid AND has minimum and maximum statistics that are equal.
9090
pub fn is_constant(array: &ArrayRef, ctx: &mut ExecutionCtx) -> VortexResult<bool> {
9191
// Short-circuit using cached array statistics.
92-
if let Some(Precision::Exact(value)) = array.statistics().get_as::<bool>(Stat::IsConstant) {
92+
if let Precision::Exact(value) = array.statistics().get_as::<bool>(Stat::IsConstant) {
9393
return Ok(value);
9494
}
9595

@@ -133,14 +133,14 @@ pub fn is_constant(array: &ArrayRef, ctx: &mut ExecutionCtx) -> VortexResult<boo
133133
}
134134

135135
// We already know here that the array is all valid, so we check for min/max stats.
136-
let min = array.statistics().get(Stat::Min);
137-
let max = array.statistics().get(Stat::Max);
136+
let min_stat = array.statistics().get(Stat::Min);
137+
let max_stat = array.statistics().get(Stat::Max);
138138

139-
if let Some((min, max)) = min.zip(max)
140-
&& min.is_exact()
139+
if let Precision::Exact(min) = min_stat.as_ref()
140+
&& let Precision::Exact(max) = max_stat.as_ref()
141141
&& min == max
142142
&& (Stat::NaNCount.dtype(array.dtype()).is_none()
143-
|| array.statistics().get_as::<u64>(Stat::NaNCount) == Some(Precision::exact(0u64)))
143+
|| array.statistics().get_as::<u64>(Stat::NaNCount) == Precision::exact(0u64))
144144
{
145145
array
146146
.statistics()

vortex-array/src/aggregate_fn/fns/is_sorted/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ fn is_sorted_impl(array: &ArrayRef, strict: bool, ctx: &mut ExecutionCtx) -> Vor
7777
};
7878

7979
// Short-circuit using cached array statistics.
80-
if let Some(Precision::Exact(value)) = array.statistics().get_as::<bool>(stat) {
80+
if let Precision::Exact(value) = array.statistics().get_as::<bool>(stat) {
8181
return Ok(value);
8282
}
8383

vortex-array/src/aggregate_fn/fns/min_max/mod.rs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,8 @@ static NAMES: LazyLock<FieldNames> = LazyLock::new(|| FieldNames::from(["min", "
4646
/// This will update the stats set of the array as a side effect.
4747
pub fn min_max(array: &ArrayRef, ctx: &mut ExecutionCtx) -> VortexResult<Option<MinMaxResult>> {
4848
// Short-circuit using cached array statistics.
49-
let cached_min = array
50-
.statistics()
51-
.get(Stat::Min)
52-
.and_then(Precision::as_exact);
53-
let cached_max = array
54-
.statistics()
55-
.get(Stat::Max)
56-
.and_then(Precision::as_exact);
49+
let cached_min = array.statistics().get(Stat::Min).as_exact();
50+
let cached_max = array.statistics().get(Stat::Max).as_exact();
5751
if let Some((min, max)) = cached_min.zip(cached_max) {
5852
let non_nullable_dtype = array.dtype().as_nonnullable();
5953
return Ok(Some(MinMaxResult {

vortex-array/src/aggregate_fn/fns/nan_count/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ use crate::scalar::ScalarValue;
3434
/// See [`NanCount`] for details.
3535
pub fn nan_count(array: &ArrayRef, ctx: &mut ExecutionCtx) -> VortexResult<usize> {
3636
// Short-circuit using cached array statistics.
37-
if let Some(Precision::Exact(nan_count_scalar)) = array.statistics().get(Stat::NaNCount) {
37+
if let Precision::Exact(nan_count_scalar) = array.statistics().get(Stat::NaNCount) {
3838
return usize::try_from(&nan_count_scalar)
3939
.map_err(|e| vortex_err!("Failed to convert NaN count stat to usize: {e}"));
4040
}

0 commit comments

Comments
 (0)