Skip to content

Commit 1ff173a

Browse files
perf[btrblocks]: write list (not list view). (#5087)
Signed-off-by: Joe Isaacs <[email protected]>
1 parent 08f57dc commit 1ff173a

File tree

1 file changed

+9
-16
lines changed

1 file changed

+9
-16
lines changed

vortex-btrblocks/src/lib.rs

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ use std::fmt::Debug;
3434
use std::hash::Hash;
3535

3636
use vortex_array::arrays::{
37-
ExtensionArray, FixedSizeListArray, ListViewArray, StructArray, TemporalArray,
37+
ExtensionArray, FixedSizeListArray, ListArray, StructArray, TemporalArray, list_from_list_view,
3838
};
3939
use vortex_array::vtable::{VTable, ValidityHelper};
4040
use vortex_array::{Array, ArrayRef, Canonical, IntoArray, ToCanonical};
@@ -398,33 +398,26 @@ impl BtrBlocksCompressor {
398398
)?
399399
.into_array())
400400
}
401-
Canonical::List(list_array) => {
402-
// Compress the inner elements.
401+
Canonical::List(list_view_array) => {
402+
// TODO(joe): We might want to write list views in the future and chose between
403+
// list and list view.
404+
let list_array = list_from_list_view(list_view_array);
405+
403406
let compressed_elems = self.compress(list_array.elements())?;
404407

405-
// Note that since the type of our offsets and sizes is not encoded in our `DType`,
406-
// we can narrow the widths.
408+
// Note that since the type of our offsets are not encoded in our `DType`,
409+
// we may narrow the widths.
407410

408-
// Compress the offsets.
409411
let compressed_offsets = IntCompressor::compress_no_dict(
410412
&list_array.offsets().to_primitive().narrow()?,
411413
false,
412414
MAX_CASCADE,
413415
&[],
414416
)?;
415417

416-
// Compress the sizes.
417-
let compressed_sizes = IntCompressor::compress_no_dict(
418-
&list_array.sizes().to_primitive().narrow()?,
419-
false,
420-
MAX_CASCADE,
421-
&[],
422-
)?;
423-
424-
Ok(ListViewArray::try_new(
418+
Ok(ListArray::try_new(
425419
compressed_elems,
426420
compressed_offsets,
427-
compressed_sizes,
428421
list_array.validity().clone(),
429422
)?
430423
.into_array())

0 commit comments

Comments
 (0)