• 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

0.0
/vortex-dtype/src/datetime/unit.rs
1
// SPDX-License-Identifier: Apache-2.0
2
// SPDX-FileCopyrightText: Copyright the Vortex contributors
3

4
use std::fmt::{Display, Formatter};
5

6
use jiff::Span;
7
use num_enum::{IntoPrimitive, TryFromPrimitive};
8
use vortex_error::VortexResult;
9

10
/// Time units for temporal data.
11
#[derive(
12
    Debug, Clone, Copy, PartialEq, Eq, Hash, Ord, PartialOrd, IntoPrimitive, TryFromPrimitive,
13
)]
14
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
15
#[repr(u8)]
16
pub enum TimeUnit {
17
    /// Nanoseconds
18
    Ns = 0,
19
    /// Microseconds
20
    Us = 1,
21
    /// Milliseconds
22
    Ms = 2,
23
    /// Seconds
24
    S = 3,
25
    /// Days
26
    D = 4,
27
}
28

29
impl TimeUnit {
30
    /// Convert to a Jiff span.
UNCOV
31
    pub fn to_jiff_span(&self, v: i64) -> VortexResult<Span> {
×
UNCOV
32
        Ok(match self {
×
33
            TimeUnit::Ns => Span::new().try_nanoseconds(v)?,
×
34
            TimeUnit::Us => Span::new().try_microseconds(v)?,
×
35
            TimeUnit::Ms => Span::new().try_milliseconds(v)?,
×
UNCOV
36
            TimeUnit::S => Span::new().try_seconds(v)?,
×
UNCOV
37
            TimeUnit::D => Span::new().try_days(v)?,
×
38
        })
UNCOV
39
    }
×
40
}
41

42
impl Display for TimeUnit {
UNCOV
43
    fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
×
UNCOV
44
        match self {
×
45
            Self::Ns => write!(f, "ns"),
×
46
            Self::Us => write!(f, "µs"),
×
UNCOV
47
            Self::Ms => write!(f, "ms"),
×
48
            Self::S => write!(f, "s"),
×
49
            Self::D => write!(f, "days"),
×
50
        }
UNCOV
51
    }
×
52
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc