Skip to content

Commit 88ca847

Browse files
committed
vx layout display
Signed-off-by: Joe Isaacs <[email protected]>
1 parent 0ceaf0a commit 88ca847

File tree

2 files changed

+10
-32
lines changed

2 files changed

+10
-32
lines changed

vortex-layout/src/display.rs

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,7 @@ mod tests {
218218
use vortex_array::arrays::PrimitiveArray;
219219
use vortex_array::builders::ArrayBuilder;
220220
use vortex_array::builders::VarBinViewBuilder;
221+
use vortex_array::serde::ArrayParts;
221222
use vortex_array::validity::Validity;
222223
use vortex_buffer::BitBufferMut;
223224
use vortex_buffer::buffer;
@@ -232,6 +233,7 @@ mod tests {
232233
use crate::IntoLayout;
233234
use crate::OwnedLayoutChildren;
234235
use crate::layouts::chunked::ChunkedLayout;
236+
use crate::layouts::flat::FlatVTable;
235237
use crate::layouts::flat::writer::FlatLayoutStrategy;
236238
use crate::layouts::struct_::StructLayout;
237239
use crate::segments::TestSegments;
@@ -413,34 +415,21 @@ vortex.chunked, dtype: i32, children: 2, rows: 10
413415
.await
414416
.unwrap();
415417

416-
// Downcast to FlatLayout to access the array_tree
417-
use vortex_array::serde::ArrayParts;
418-
419-
use crate::layouts::flat::FlatVTable;
420-
421418
let flat_layout = layout.as_::<FlatVTable>();
422419

423-
// Verify that array_tree is populated when FLAT_LAYOUT_INLINE_ARRAY_NODE is set
424420
let array_tree = flat_layout
425421
.array_tree()
426422
.expect("array_tree should be populated when FLAT_LAYOUT_INLINE_ARRAY_NODE is set");
427423

428-
// Verify from_array_tree works on the inline metadata
429424
let parts = ArrayParts::from_array_tree(array_tree.as_ref().to_vec())
430425
.expect("should parse array_tree");
431426
assert_eq!(parts.buffer_lengths(), vec![20]); // 5 i32 values = 20 bytes
432427

433-
// Test display_array_tree exact output
434-
let array_tree_display = flat_layout.display_array_tree();
435-
assert_eq!(
436-
format!("{}", array_tree_display),
437-
"ArrayTree(vortex.primitive, buffers=[20B])"
438-
);
439-
440-
// Test display_tree exact output
441428
assert_eq!(
442-
format!("{}", layout.display_tree()),
443-
"vortex.flat, dtype: i32?, segment 0, buffers=[20B], total=20B\n"
429+
layout.display_tree().to_string(),
430+
"\
431+
vortex.flat, dtype: i32?, segment 0, buffers=[20B], total=20B
432+
"
444433
);
445434
})
446435
}
@@ -469,8 +458,10 @@ vortex.chunked, dtype: i32, children: 2, rows: 10
469458

470459
// Test display_tree exact output (with inline array_tree enabled by env var from other test)
471460
assert_eq!(
472-
format!("{}", layout.display_tree()),
473-
"vortex.flat, dtype: i64, segment 0, buffers=[24B], total=24B\n"
461+
layout.display_tree().to_string(),
462+
"\
463+
vortex.flat, dtype: i64, segment 0, buffers=[24B], total=24B
464+
"
474465
);
475466
})
476467
}

vortex-layout/src/layouts/flat/mod.rs

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -184,19 +184,6 @@ impl FlatLayout {
184184
pub fn array_tree(&self) -> Option<&ByteBuffer> {
185185
self.array_tree.as_ref()
186186
}
187-
188-
/// Returns a display-friendly representation of the array tree metadata.
189-
///
190-
/// When `FLAT_LAYOUT_INLINE_ARRAY_NODE` is enabled, this parses the inlined flatbuffer
191-
/// and displays information about the array encoding tree and buffer descriptors.
192-
/// When the array tree is not inlined, displays the segment ID instead.
193-
pub fn display_array_tree(&self) -> ArrayTreeDisplay {
194-
ArrayTreeDisplay {
195-
array_tree: self.array_tree.clone(),
196-
segment_id: self.segment_id,
197-
ctx: self.ctx.clone(),
198-
}
199-
}
200187
}
201188

202189
/// Display wrapper for the array tree metadata stored in a FlatLayout.

0 commit comments

Comments
 (0)