• 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-array/src/array/display/tree.rs
1
// SPDX-License-Identifier: Apache-2.0
2
// SPDX-FileCopyrightText: Copyright the Vortex contributors
3

4
use std::fmt::{self};
5

6
use humansize::{DECIMAL, format_size};
7

8
use crate::arrays::ChunkedEncoding;
9
use crate::display::DisplayOptions;
10
use crate::{Array, ArrayRef, ArrayVisitor};
11

12
pub(super) struct TreeDisplayWrapper(pub(super) ArrayRef);
13

14
impl fmt::Display for TreeDisplayWrapper {
UNCOV
15
    fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
×
UNCOV
16
        let mut array_fmt = TreeFormatter {
×
UNCOV
17
            fmt,
×
UNCOV
18
            indent: "".to_string(),
×
UNCOV
19
            total_size: None,
×
UNCOV
20
        };
×
UNCOV
21
        array_fmt.format("root", self.0.clone())
×
UNCOV
22
    }
×
23
}
24

25
pub struct TreeFormatter<'a, 'b: 'a> {
26
    fmt: &'a mut fmt::Formatter<'b>,
27
    indent: String,
28
    total_size: Option<u64>,
29
}
30

31
impl<'a, 'b: 'a> TreeFormatter<'a, 'b> {
UNCOV
32
    fn format(&mut self, name: &str, array: ArrayRef) -> fmt::Result {
×
UNCOV
33
        let nbytes = array.nbytes();
×
UNCOV
34
        let total_size = self.total_size.unwrap_or(nbytes);
×
UNCOV
35
        writeln!(
×
UNCOV
36
            self,
×
UNCOV
37
            "{}: {} nbytes={} ({:.2}%)",
×
38
            name,
UNCOV
39
            array.display_as(DisplayOptions::MetadataOnly),
×
UNCOV
40
            format_size(nbytes, DECIMAL),
×
UNCOV
41
            100_f64 * nbytes as f64 / total_size as f64
×
42
        )?;
×
43

UNCOV
44
        self.indent(|i| {
×
UNCOV
45
            write!(i, "metadata: ")?;
×
UNCOV
46
            array.metadata_fmt(i.fmt)?;
×
UNCOV
47
            writeln!(i.fmt)?;
×
48

UNCOV
49
            for buffer in array.buffers() {
×
UNCOV
50
                writeln!(
×
UNCOV
51
                    i,
×
UNCOV
52
                    "buffer (align={}): {} ({:.2}%)",
×
UNCOV
53
                    buffer.alignment(),
×
UNCOV
54
                    format_size(buffer.len(), DECIMAL),
×
UNCOV
55
                    100_f64 * buffer.len() as f64 / nbytes as f64
×
56
                )?;
×
57
            }
58

UNCOV
59
            Ok(())
×
UNCOV
60
        })?;
×
61

UNCOV
62
        let old_total_size = self.total_size;
×
UNCOV
63
        if array.is_encoding(ChunkedEncoding.id()) {
×
64
            // Clear the total size so each chunk is treated as a new root.
65
            self.total_size = None
×
UNCOV
66
        } else {
×
UNCOV
67
            self.total_size = Some(nbytes);
×
UNCOV
68
        }
×
69

UNCOV
70
        self.indent(|i| {
×
UNCOV
71
            for (name, child) in array
×
UNCOV
72
                .children_names()
×
UNCOV
73
                .into_iter()
×
UNCOV
74
                .zip(array.children().into_iter())
×
75
            {
UNCOV
76
                i.format(&name, child)?;
×
77
            }
UNCOV
78
            Ok(())
×
UNCOV
79
        })?;
×
80

UNCOV
81
        self.total_size = old_total_size;
×
UNCOV
82
        Ok(())
×
UNCOV
83
    }
×
84

UNCOV
85
    fn indent<F>(&mut self, indented: F) -> fmt::Result
×
UNCOV
86
    where
×
UNCOV
87
        F: FnOnce(&mut TreeFormatter) -> fmt::Result,
×
88
    {
UNCOV
89
        let original_ident = self.indent.clone();
×
UNCOV
90
        self.indent += "  ";
×
UNCOV
91
        let res = indented(self);
×
UNCOV
92
        self.indent = original_ident;
×
UNCOV
93
        res
×
UNCOV
94
    }
×
95

UNCOV
96
    fn write_fmt(&mut self, fmt: fmt::Arguments<'_>) -> fmt::Result {
×
UNCOV
97
        write!(self.fmt, "{}{}", self.indent, fmt)
×
UNCOV
98
    }
×
99
}
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