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

vortex-data / vortex / 16778140195

06 Aug 2025 01:20PM UTC coverage: 84.03% (+0.001%) from 84.029%
16778140195

Pull #4137

github

web-flow
Merge 75f996f59 into 4d596c4b4
Pull Request #4137: VTable metadata is owned

53 of 73 new or added lines in 48 files covered. (72.6%)

6 existing lines in 2 files now uncovered.

48334 of 57520 relevant lines covered (84.03%)

520765.28 hits per line

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

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

4
use std::fmt::Debug;
5

6
use vortex_buffer::ByteBuffer;
7
use vortex_dtype::DType;
8
use vortex_error::{VortexResult, vortex_bail};
9

10
use crate::serde::ArrayChildren;
11
use crate::vtable::{NotSupported, VTable};
12
use crate::{DeserializeMetadata, EmptyMetadata, SerializeMetadata};
13

14
/// VTable for assisting with the serialization and deserialiation of arrays.
15
///
16
/// It is required to implement this vtable in order to support:
17
///  * Serialization to disk or over IPC.
18
///  * Import/export over FFI.
19
pub trait SerdeVTable<V: VTable> {
20
    type Metadata: Debug + SerializeMetadata + DeserializeMetadata;
21

22
    /// Exports the metadata for the array.
23
    ///
24
    /// All other parts of the array are exported using the [`crate::vtable::VisitorVTable`].
25
    ///
26
    /// * If the array does not require serialized metadata, it should return
27
    ///   [`crate::metadata::EmptyMetadata`].
28
    /// * If the array does not support serialization, it should return `None`.
29
    fn metadata(array: &V::Array) -> VortexResult<Option<Self::Metadata>>;
30

31
    /// Build an array from its given parts.
32
    fn build(
33
        encoding: &V::Encoding,
34
        dtype: &DType,
35
        len: usize,
36
        metadata: <Self::Metadata as DeserializeMetadata>::Output,
37
        buffers: &[ByteBuffer],
38
        children: &dyn ArrayChildren,
39
    ) -> VortexResult<V::Array>;
40
}
41

42
impl<V: VTable> SerdeVTable<V> for NotSupported {
43
    type Metadata = EmptyMetadata;
44

45
    fn metadata(_array: &V::Array) -> VortexResult<Option<Self::Metadata>> {
×
46
        Ok(None)
×
47
    }
×
48

49
    fn build(
×
50
        encoding: &V::Encoding,
×
51
        _dtype: &DType,
×
52
        _len: usize,
×
NEW
53
        _metadata: Self::Metadata,
×
54
        _buffers: &[ByteBuffer],
×
55
        _children: &dyn ArrayChildren,
×
56
    ) -> VortexResult<V::Array> {
×
57
        vortex_bail!("Serde not supported by {} encoding", V::id(encoding));
×
58
    }
×
59
}
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