Skip to content

Commit a6f0110

Browse files
committed
fixups
Signed-off-by: Adam Gutglick <adam@spiraldb.com>
1 parent 2191aa0 commit a6f0110

11 files changed

Lines changed: 91 additions & 75 deletions

File tree

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)?;

vortex-array/public-api.lock

Lines changed: 26 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11950,7 +11950,7 @@ pub mod vortex_array::expr::stats
1195011950

1195111951
pub enum vortex_array::expr::stats::IntersectionResult<T>
1195211952

11953-
pub vortex_array::expr::stats::IntersectionResult::None
11953+
pub vortex_array::expr::stats::IntersectionResult::Empty
1195411954

1195511955
pub vortex_array::expr::stats::IntersectionResult::Value(T)
1195611956

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

1197711977
pub enum vortex_array::expr::stats::Precision<T>
1197811978

11979+
pub vortex_array::expr::stats::Precision::Absent
11980+
1197911981
pub vortex_array::expr::stats::Precision::Exact(T)
1198011982

1198111983
pub vortex_array::expr::stats::Precision::Inexact(T)
@@ -11988,6 +11990,10 @@ impl vortex_array::expr::stats::Precision<vortex_array::scalar::ScalarValue>
1198811990

1198911991
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>
1199011992

11993+
impl<T, E> vortex_array::expr::stats::Precision<core::result::Result<T, E>>
11994+
11995+
pub fn vortex_array::expr::stats::Precision<core::result::Result<T, E>>::transpose(self) -> core::result::Result<vortex_array::expr::stats::Precision<T>, E>
11996+
1199111997
impl<T> vortex_array::expr::stats::Precision<T> where T: core::marker::Copy
1199211998

1199311999
pub fn vortex_array::expr::stats::Precision<T>::to_inexact(&self) -> Self
@@ -12006,19 +12012,19 @@ pub fn vortex_array::expr::stats::Precision<T>::inexact<S: core::convert::Into<T
1200612012

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

12009-
pub fn vortex_array::expr::stats::Precision<T>::into_inner(self) -> T
12015+
pub fn vortex_array::expr::stats::Precision<T>::into_inner(self) -> core::option::Option<T>
12016+
12017+
pub fn vortex_array::expr::stats::Precision<T>::is_absent(&self) -> bool
1201012018

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

1201312021
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>
1201412022

12015-
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>>
12016-
1201712023
pub fn vortex_array::expr::stats::Precision<T>::zip<U>(self, vortex_array::expr::stats::Precision<U>) -> vortex_array::expr::stats::Precision<(T, U)>
1201812024

1201912025
impl<T> vortex_array::expr::stats::Precision<T>
1202012026

12021-
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
12027+
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>
1202212028

1202312029
impl<T> vortex_array::expr::stats::Precision<core::option::Option<T>>
1202412030

@@ -12060,6 +12066,10 @@ pub fn vortex_array::expr::stats::Precision<T>::fmt(&self, &mut core::fmt::Forma
1206012066

1206112067
impl<T: core::marker::Copy> core::marker::Copy for vortex_array::expr::stats::Precision<T>
1206212068

12069+
impl<T> core::default::Default for vortex_array::expr::stats::Precision<T>
12070+
12071+
pub fn vortex_array::expr::stats::Precision<T>::default() -> Self
12072+
1206312073
impl<T> core::marker::StructuralPartialEq for vortex_array::expr::stats::Precision<T>
1206412074

1206512075
#[repr(u8)] pub enum vortex_array::expr::stats::Stat
@@ -12426,47 +12436,47 @@ pub const vortex_array::expr::stats::UncompressedSizeInBytes::STAT: vortex_array
1242612436

1242712437
pub trait vortex_array::expr::stats::StatsProvider
1242812438

12429-
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>>
12439+
pub fn vortex_array::expr::stats::StatsProvider::get(&self, vortex_array::expr::stats::Stat) -> vortex_array::expr::stats::Precision<vortex_array::scalar::Scalar>
1243012440

1243112441
pub fn vortex_array::expr::stats::StatsProvider::is_empty(&self) -> bool
1243212442

1243312443
pub fn vortex_array::expr::stats::StatsProvider::len(&self) -> usize
1243412444

1243512445
impl vortex_array::expr::stats::StatsProvider for vortex_array::stats::MutTypedStatsSetRef<'_, '_>
1243612446

12437-
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>>
12447+
pub fn vortex_array::stats::MutTypedStatsSetRef<'_, '_>::get(&self, vortex_array::expr::stats::Stat) -> vortex_array::expr::stats::Precision<vortex_array::scalar::Scalar>
1243812448

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

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

1244312453
impl vortex_array::expr::stats::StatsProvider for vortex_array::stats::StatsSetRef<'_>
1244412454

12445-
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>>
12455+
pub fn vortex_array::stats::StatsSetRef<'_>::get(&self, vortex_array::expr::stats::Stat) -> vortex_array::expr::stats::Precision<vortex_array::scalar::Scalar>
1244612456

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

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

1245112461
impl vortex_array::expr::stats::StatsProvider for vortex_array::stats::TypedStatsSetRef<'_, '_>
1245212462

12453-
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>>
12463+
pub fn vortex_array::stats::TypedStatsSetRef<'_, '_>::get(&self, vortex_array::expr::stats::Stat) -> vortex_array::expr::stats::Precision<vortex_array::scalar::Scalar>
1245412464

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

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

1245912469
pub trait vortex_array::expr::stats::StatsProviderExt: vortex_array::expr::stats::StatsProvider
1246012470

12461-
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>>
12471+
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>
1246212472

1246312473
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>
1246412474

1246512475
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>
1246612476

1246712477
impl<S> vortex_array::expr::stats::StatsProviderExt for S where S: vortex_array::expr::stats::StatsProvider
1246812478

12469-
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>>
12479+
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>
1247012480

1247112481
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>
1247212482

@@ -19982,7 +19992,7 @@ pub fn vortex_array::stats::MutTypedStatsSetRef<'_, '_>::merge_unordered(self, &
1998219992

1998319993
impl vortex_array::expr::stats::StatsProvider for vortex_array::stats::MutTypedStatsSetRef<'_, '_>
1998419994

19985-
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>>
19995+
pub fn vortex_array::stats::MutTypedStatsSetRef<'_, '_>::get(&self, vortex_array::expr::stats::Stat) -> vortex_array::expr::stats::Precision<vortex_array::scalar::Scalar>
1998619996

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

@@ -20020,9 +20030,9 @@ impl vortex_array::stats::StatsSet
2002020030

2002120031
pub fn vortex_array::stats::StatsSet::clear(&mut self, vortex_array::expr::stats::Stat)
2002220032

20023-
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>>
20033+
pub fn vortex_array::stats::StatsSet::get(&self, vortex_array::expr::stats::Stat) -> vortex_array::expr::stats::Precision<vortex_array::scalar::ScalarValue>
2002420034

20025-
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>>
20035+
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>
2002620036

2002720037
pub fn vortex_array::stats::StatsSet::is_empty(&self) -> bool
2002820038

@@ -20144,7 +20154,7 @@ pub fn vortex_array::stats::StatsSetRef<'_>::with_typed_stats_set<U, F: core::op
2014420154

2014520155
impl vortex_array::expr::stats::StatsProvider for vortex_array::stats::StatsSetRef<'_>
2014620156

20147-
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>>
20157+
pub fn vortex_array::stats::StatsSetRef<'_>::get(&self, vortex_array::expr::stats::Stat) -> vortex_array::expr::stats::Precision<vortex_array::scalar::Scalar>
2014820158

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

@@ -20164,7 +20174,7 @@ pub vortex_array::stats::TypedStatsSetRef::values: &'a vortex_array::stats::Stat
2016420174

2016520175
impl vortex_array::expr::stats::StatsProvider for vortex_array::stats::TypedStatsSetRef<'_, '_>
2016620176

20167-
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>>
20177+
pub fn vortex_array::stats::TypedStatsSetRef<'_, '_>::get(&self, vortex_array::expr::stats::Stat) -> vortex_array::expr::stats::Precision<vortex_array::scalar::Scalar>
2016820178

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

vortex-array/src/expr/stats/precision.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,13 @@ impl<T> Precision<Option<T>> {
5050
}
5151

5252
impl<T, E> Precision<Result<T, E>> {
53+
/// Transpose a `Precision<Result<T, E>>` into a `Result<Precision<T>, E>`.
5354
pub fn transpose(self) -> Result<Precision<T>, E> {
54-
todo!()
55+
match self {
56+
Self::Exact(value) => value.map(Precision::Exact),
57+
Self::Inexact(value) => value.map(Precision::Inexact),
58+
Self::Absent => Ok(Precision::Absent),
59+
}
5560
}
5661
}
5762

vortex-datafusion/src/convert/stats.rs

Lines changed: 44 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -27,55 +27,52 @@ pub(crate) fn stats_set_to_df(
2727
// TODO(connor): There's a lot that can go wrong here, should probably handle this
2828
// more gracefully...
2929
// Find the min statistic.
30-
let min = stats_set.get(Stat::Min).and_then(|pstat_val| {
31-
pstat_val
32-
.map(|stat_val| {
33-
Scalar::try_new(
34-
Stat::Min
35-
.dtype(dtype)
36-
.vortex_expect("must have a valid dtype"),
37-
Some(stat_val),
38-
)
39-
.vortex_expect("`Stat::Min` somehow had an incompatible `DType`")
40-
.try_to_df()
41-
.ok()
42-
})
43-
.transpose()
44-
});
30+
let min = stats_set
31+
.get(Stat::Min)
32+
.map(|stat_val| {
33+
Scalar::try_new(
34+
Stat::Min
35+
.dtype(dtype)
36+
.vortex_expect("must have a valid dtype"),
37+
Some(stat_val),
38+
)
39+
.vortex_expect("`Stat::Min` somehow had an incompatible `DType`")
40+
.try_to_df()
41+
.ok()
42+
})
43+
.transpose();
4544

4645
// Find the max statistic.
47-
let max = stats_set.get(Stat::Max).and_then(|pstat_val| {
48-
pstat_val
49-
.map(|stat_val| {
50-
Scalar::try_new(
51-
Stat::Max
52-
.dtype(dtype)
53-
.vortex_expect("must have a valid dtype"),
54-
Some(stat_val),
55-
)
56-
.vortex_expect("`Stat::Max` somehow had an incompatible `DType`")
57-
.try_to_df()
58-
.ok()
59-
})
60-
.transpose()
61-
});
46+
let max = stats_set
47+
.get(Stat::Max)
48+
.map(|stat_val| {
49+
Scalar::try_new(
50+
Stat::Max
51+
.dtype(dtype)
52+
.vortex_expect("must have a valid dtype"),
53+
Some(stat_val),
54+
)
55+
.vortex_expect("`Stat::Max` somehow had an incompatible `DType`")
56+
.try_to_df()
57+
.ok()
58+
})
59+
.transpose();
6260

6361
// Find the sum statistic
64-
let sum = stats_set.get(Stat::Sum).and_then(|pstat_val| {
65-
pstat_val
66-
.map(|stat_val| {
67-
Scalar::try_new(
68-
Stat::Sum
69-
.dtype(dtype)
70-
.vortex_expect("must have a valid dtype"),
71-
Some(stat_val),
72-
)
73-
.vortex_expect("`Stat::Sum` somehow had an incompatible `DType`")
74-
.try_to_df()
75-
.ok()
76-
})
77-
.transpose()
78-
});
62+
let sum = stats_set
63+
.get(Stat::Sum)
64+
.map(|stat_val| {
65+
Scalar::try_new(
66+
Stat::Sum
67+
.dtype(dtype)
68+
.vortex_expect("must have a valid dtype"),
69+
Some(stat_val),
70+
)
71+
.vortex_expect("`Stat::Sum` somehow had an incompatible `DType`")
72+
.try_to_df()
73+
.ok()
74+
})
75+
.transpose();
7976

8077
let null_count = stats_set.get_as::<usize>(Stat::NullCount, &PType::U64.into());
8178

@@ -92,9 +89,9 @@ pub(crate) fn stats_set_to_df(
9289
}
9390

9491
pub(crate) fn is_constant_to_distinct_count(
95-
is_constant: Option<VortexPrecision<bool>>,
92+
is_constant: VortexPrecision<bool>,
9693
) -> Precision<usize> {
97-
match is_constant.and_then(VortexPrecision::as_exact) {
94+
match is_constant.as_exact() {
9895
Some(true) => Precision::Exact(1),
9996
Some(false) | None => Precision::Absent,
10097
}

vortex-datafusion/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ where
119119
match self {
120120
Precision::Exact(v) => DFPrecision::Exact(v),
121121
Precision::Inexact(v) => DFPrecision::Inexact(v),
122+
Precision::Absent => DFPrecision::Absent,
122123
}
123124
}
124125
}

vortex-datafusion/src/persistent/format.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -639,18 +639,19 @@ impl FileFormat for VortexFormat {
639639

640640
fn scalar_stat_to_df(
641641
stat: Stat,
642-
value: Option<stats::Precision<VortexScalarValue>>,
642+
value: stats::Precision<VortexScalarValue>,
643643
stats_dtype: &DType,
644644
target_dtype: &DType,
645645
) -> Option<stats::Precision<DFScalarValue>> {
646646
let stat_dtype = stat.dtype(stats_dtype)?;
647647

648-
value?
649-
.try_map(|stat_value| {
648+
value
649+
.map(|stat_value| {
650650
Scalar::try_new(stat_dtype, Some(stat_value))?
651651
.cast(target_dtype)?
652652
.try_to_df()
653653
})
654+
.transpose()
654655
.ok()
655656
}
656657

vortex-file/src/pruning.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ pub fn extract_relevant_file_stats_as_struct_row(
6060
stat,
6161
Stat::Max | Stat::Min | Stat::NaNCount | Stat::NullCount
6262
) {
63-
let Some(stat_value) = typed_stats.get(*stat).and_then(|p| p.as_exact()) else {
63+
let Some(stat_value) = typed_stats.get(*stat).as_exact() else {
6464
vortex_bail!("missing stat {}, {} from stats set", field, stat)
6565
};
6666
columns.push((

vortex-file/src/v2/file_stats_reader.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ impl StatsCatalog for FileStatsLayoutReader {
132132
let field_idx = self.struct_fields.find(field_name)?;
133133
let field_stats = self.file_stats.stats_sets().get(field_idx)?;
134134

135-
let stat_value = field_stats.get(stat)?.as_exact()?;
135+
let stat_value = field_stats.get(stat).as_exact()?;
136136
let field_dtype = self.struct_fields.field_by_index(field_idx)?;
137137
let stat_dtype = stat.dtype(&field_dtype)?;
138138
let stat_scalar = Scalar::try_new(stat_dtype, Some(stat_value)).ok()?;

vortex-flatbuffers/public-api.lock

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -450,6 +450,8 @@ pub fn vortex_flatbuffers::array::Compression::run_verifier(&mut flatbuffers::ve
450450

451451
impl vortex_flatbuffers::array::Precision
452452

453+
pub const vortex_flatbuffers::array::Precision::Absent: Self
454+
453455
pub const vortex_flatbuffers::array::Precision::ENUM_MAX: u8
454456

455457
pub const vortex_flatbuffers::array::Precision::ENUM_MIN: u8
@@ -532,7 +534,7 @@ pub const vortex_flatbuffers::array::ENUM_MIN_PRECISION: u8
532534

533535
pub const vortex_flatbuffers::array::ENUM_VALUES_COMPRESSION: [vortex_flatbuffers::array::Compression; 2]
534536

535-
pub const vortex_flatbuffers::array::ENUM_VALUES_PRECISION: [vortex_flatbuffers::array::Precision; 2]
537+
pub const vortex_flatbuffers::array::ENUM_VALUES_PRECISION: [vortex_flatbuffers::array::Precision; 3]
536538

537539
pub fn vortex_flatbuffers::array::finish_array_buffer<'a, 'b, A: flatbuffers::builder::Allocator + 'a>(&'b mut flatbuffers::builder::FlatBufferBuilder<'a, A>, flatbuffers::primitives::WIPOffset<vortex_flatbuffers::array::Array<'a>>)
538540

vortex-layout/src/layouts/flat/writer.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,8 @@ fn truncate_scalar_stat<F: Fn(Scalar) -> Option<(Scalar, bool)>>(
8181
stat: Stat,
8282
truncation: F,
8383
) {
84-
if let Some(sv) = statistics.get(stat) {
85-
if let Some((truncated_value, truncated)) = truncation(sv.into_inner()) {
84+
if let Some(sv) = statistics.get(stat).into_inner() {
85+
if let Some((truncated_value, truncated)) = truncation(sv) {
8686
if truncated && let Some(v) = truncated_value.into_value() {
8787
statistics.set(stat, Precision::Inexact(v));
8888
}

0 commit comments

Comments
 (0)