• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

vortex-data / vortex / 16728097825

04 Aug 2025 04:00PM UTC coverage: 48.355% (-35.1%) from 83.429%
16728097825

Pull #4108

github

web-flow
Merge 1b2d27fd8 into 649ba9576
Pull Request #4108: perf[vortex-array]: use all_valid instead of `invalid_count() == 0`

1 of 1 new or added line in 1 file covered. (100.0%)

11596 existing lines in 378 files now uncovered.

18635 of 38538 relevant lines covered (48.35%)

151786.4 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

59.38
/vortex-array/src/stats/traits.rs
1
// SPDX-License-Identifier: Apache-2.0
2
// SPDX-FileCopyrightText: Copyright the Vortex contributors
3

4
use vortex_dtype::DType;
5
use vortex_error::{VortexError, VortexExpect, vortex_panic};
6
use vortex_scalar::{Scalar, ScalarValue};
7

8
use super::{Precision, Stat, StatType};
9

10
pub trait StatsProvider {
11
    fn get(&self, stat: Stat) -> Option<Precision<ScalarValue>>;
12

13
    /// Count of stored stats with known values.
14
    fn len(&self) -> usize;
15

16
    /// Predicate equivalent to a [len][Self::len] of zero.
17
    fn is_empty(&self) -> bool {
×
18
        self.len() == 0
×
19
    }
×
20
}
21

22
impl<S> StatsProviderExt for S where S: StatsProvider {}
23

24
pub trait StatsProviderExt: StatsProvider {
25
    fn get_scalar(&self, stat: Stat, dtype: &DType) -> Option<Precision<Scalar>> {
52,000✔
26
        let stat_dtype = stat
52,000✔
27
            .dtype(dtype)
52,000✔
28
            .vortex_expect("getting scalar for stat dtype");
52,000✔
29
        self.get(stat).map(|v| v.into_scalar(stat_dtype))
52,000✔
30
    }
52,000✔
31

32
    fn get_scalar_bound<S: StatType<Scalar>>(&self, dtype: &DType) -> Option<S::Bound> {
1,112✔
33
        self.get_scalar(S::STAT, dtype).map(|v| v.bound::<S>())
1,112✔
34
    }
1,112✔
35

36
    fn get_as<T: for<'a> TryFrom<&'a ScalarValue, Error = VortexError>>(
106,876✔
37
        &self,
106,876✔
38
        stat: Stat,
106,876✔
39
    ) -> Option<Precision<T>> {
106,876✔
40
        self.get(stat).map(|v| {
106,876✔
41
            v.map(|v| {
49,590✔
42
                T::try_from(&v).unwrap_or_else(|err| {
49,590✔
43
                    vortex_panic!(
×
44
                        err,
×
45
                        "Failed to get stat {} as {}",
×
46
                        stat,
47
                        std::any::type_name::<T>()
×
48
                    )
49
                })
50
            })
49,590✔
51
        })
49,590✔
52
    }
106,876✔
53

UNCOV
54
    fn get_as_bound<S, U>(&self) -> Option<S::Bound>
×
UNCOV
55
    where
×
UNCOV
56
        S: StatType<U>,
×
UNCOV
57
        U: for<'a> TryFrom<&'a ScalarValue, Error = VortexError>,
×
58
    {
UNCOV
59
        self.get_as::<U>(S::STAT).map(|v| v.bound::<S>())
×
UNCOV
60
    }
×
61
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc