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

vortex-data / vortex / 16935267080

13 Aug 2025 11:00AM UTC coverage: 24.312% (-63.3%) from 87.658%
16935267080

Pull #4226

github

web-flow
Merge 81b48c7fb into baa6ea202
Pull Request #4226: Support converting TimestampTZ to and from duckdb

0 of 2 new or added lines in 1 file covered. (0.0%)

20666 existing lines in 469 files now uncovered.

8726 of 35892 relevant lines covered (24.31%)

147.74 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 {
×
UNCOV
45
            Self::Ns => write!(f, "ns"),
×
UNCOV
46
            Self::Us => write!(f, "µs"),
×
UNCOV
47
            Self::Ms => write!(f, "ms"),
×
UNCOV
48
            Self::S => write!(f, "s"),
×
UNCOV
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