• 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

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

4
use std::fmt::{Debug, Formatter};
5
use std::ops::Deref;
6

7
use vortex_error::{VortexResult, vortex_bail};
8

9
/// Trait for serializing Vortex metadata to a vector of unaligned bytes.
10
pub trait SerializeMetadata {
11
    fn serialize(self) -> Vec<u8>;
12
}
13

14
/// Trait for deserializing Vortex metadata from a vector of unaligned bytes.
15
pub trait DeserializeMetadata
16
where
17
    Self: Sized,
18
{
19
    /// The fully deserialized type of the metadata.
20
    type Output;
21

22
    /// Deserialize metadata from a vector of unaligned bytes.
23
    fn deserialize(metadata: &[u8]) -> VortexResult<Self::Output>;
24
}
25

26
/// Empty array metadata
27
#[derive(Debug)]
28
pub struct EmptyMetadata;
29

30
impl SerializeMetadata for EmptyMetadata {
31
    fn serialize(self) -> Vec<u8> {
64✔
32
        vec![]
64✔
33
    }
64✔
34
}
35

36
impl DeserializeMetadata for EmptyMetadata {
37
    type Output = EmptyMetadata;
38

39
    fn deserialize(metadata: &[u8]) -> VortexResult<Self::Output> {
14✔
40
        if !metadata.is_empty() {
14✔
41
            vortex_bail!("EmptyMetadata should not have metadata bytes")
×
42
        }
14✔
43
        Ok(EmptyMetadata)
14✔
44
    }
14✔
45
}
46

47
/// A utility wrapper for raw metadata serialization. This delegates the serialiation step
48
/// to the arrays' vtable.
49
pub struct RawMetadata(pub Vec<u8>);
50

51
impl SerializeMetadata for RawMetadata {
52
    fn serialize(self) -> Vec<u8> {
×
53
        self.0
×
54
    }
×
55
}
56

57
impl DeserializeMetadata for RawMetadata {
58
    type Output = Vec<u8>;
59

60
    fn deserialize(metadata: &[u8]) -> VortexResult<Self::Output> {
×
61
        Ok(metadata.to_vec())
×
62
    }
×
63
}
64

65
impl Debug for RawMetadata {
66
    fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
×
67
        write!(f, "\"{}\"", self.0.escape_ascii())
×
68
    }
×
69
}
70

71
/// A utility wrapper for Prost metadata serialization.
72
pub struct ProstMetadata<M>(pub M);
73

74
impl<M> Deref for ProstMetadata<M> {
75
    type Target = M;
76

77
    fn deref(&self) -> &Self::Target {
×
78
        &self.0
×
79
    }
×
80
}
81

82
impl<M: Debug> Debug for ProstMetadata<M> {
UNCOV
83
    fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
×
UNCOV
84
        self.0.fmt(f)
×
UNCOV
85
    }
×
86
}
87

88
impl<M> SerializeMetadata for ProstMetadata<M>
89
where
90
    M: prost::Message,
91
{
92
    fn serialize(self) -> Vec<u8> {
28✔
93
        self.0.encode_to_vec()
28✔
94
    }
28✔
95
}
96

97
impl<M> DeserializeMetadata for ProstMetadata<M>
98
where
99
    M: Debug,
100
    M: prost::Message + Default,
101
{
102
    type Output = M;
103

104
    fn deserialize(metadata: &[u8]) -> VortexResult<Self::Output> {
6✔
105
        Ok(M::decode(metadata)?)
6✔
106
    }
6✔
107
}
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