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

vortex-data / vortex / 16969983197

14 Aug 2025 03:45PM UTC coverage: 85.882% (-1.8%) from 87.693%
16969983197

Pull #4215

github

web-flow
Merge 6636736da into f547cbca5
Pull Request #4215: Ji/vectors

80 of 1729 new or added lines in 38 files covered. (4.63%)

117 existing lines in 25 files now uncovered.

56994 of 66363 relevant lines covered (85.88%)

609331.7 hits per line

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

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

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

6
use vortex_dtype::half::f16;
7
use vortex_dtype::{NativePType, PType};
8

9
use crate::arrays::BinaryView;
10

11
/// Defines the "vector type", a physical type describing the data that's held in the vector.
12
///
13
/// See the specific vector view types, e.g. [`PrimitiveVector`], for more details.
14
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
15
pub enum VType {
16
    Bool,
17
    Primitive(PType),
18
    Binary,
19
}
20

21
impl Display for VType {
NEW
22
    fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
×
NEW
23
        match self {
×
NEW
24
            VType::Bool => write!(f, "bool"),
×
NEW
25
            VType::Primitive(ptype) => write!(f, "{}", ptype),
×
NEW
26
            VType::Binary => write!(f, "binary"),
×
27
        }
NEW
28
    }
×
29
}
30

31
impl VType {
NEW
32
    pub fn of<T: Element>() -> Self {
×
NEW
33
        T::vtype()
×
NEW
34
    }
×
35

NEW
36
    pub fn byte_width(&self) -> usize {
×
NEW
37
        match self {
×
NEW
38
            VType::Bool => 1,
×
NEW
39
            VType::Primitive(ptype) => ptype.byte_width(),
×
NEW
40
            VType::Binary => size_of::<BinaryView>(),
×
41
        }
NEW
42
    }
×
43
}
44

45
/// A trait to identify canonical vector types.
46
pub trait Element: 'static + Copy + Debug {
47
    fn vtype() -> VType;
48
}
49

50
/// NOTE: for now, we have chosen to store boolean values as byte-sized booleans instead
51
///  of packed into a bit mask, this is typically more efficient for SIMD compute operations.
52
///  For masks, we still use bit-packed booleans.
53
impl Element for bool {
NEW
54
    fn vtype() -> VType {
×
NEW
55
        VType::Bool
×
NEW
56
    }
×
57
}
58

59
macro_rules! canonical_ptype {
60
    ($T:ty) => {
61
        impl Element for $T {
NEW
62
            fn vtype() -> VType {
×
NEW
63
                VType::Primitive(<$T as NativePType>::PTYPE)
×
NEW
64
            }
×
65
        }
66
    };
67
}
68

69
canonical_ptype!(u8);
70
canonical_ptype!(u16);
71
canonical_ptype!(u32);
72
canonical_ptype!(u64);
73
canonical_ptype!(i8);
74
canonical_ptype!(i16);
75
canonical_ptype!(i32);
76
canonical_ptype!(i64);
77
canonical_ptype!(f16);
78
canonical_ptype!(f32);
79
canonical_ptype!(f64);
80

81
impl Element for BinaryView {
NEW
82
    fn vtype() -> VType {
×
NEW
83
        VType::Binary
×
NEW
84
    }
×
85
}
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