Skip to content

Commit bef1774

Browse files
committed
avoid eager struct canonicalizing
Signed-off-by: Andrew Duffy <[email protected]>
1 parent 10a2e56 commit bef1774

File tree

2 files changed

+10
-16
lines changed

2 files changed

+10
-16
lines changed

encodings/fsst/src/array.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ use vortex_array::DeserializeMetadata;
2121
use vortex_array::Precision;
2222
use vortex_array::ProstMetadata;
2323
use vortex_array::SerializeMetadata;
24-
use vortex_array::ToCanonical;
2524
use vortex_array::arrays::VarBinArray;
2625
use vortex_array::arrays::VarBinVTable;
2726
use vortex_array::serde::ArrayChildren;

vortex-layout/src/layouts/struct_/reader.rs

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
// SPDX-FileCopyrightText: Copyright the Vortex contributors
33

44
use std::collections::BTreeSet;
5-
use std::ops::Not;
65
use std::ops::Range;
76
use std::sync::Arc;
87

@@ -11,9 +10,8 @@ use itertools::Itertools;
1110
use vortex_array::ArrayRef;
1211
use vortex_array::IntoArray;
1312
use vortex_array::MaskFuture;
14-
use vortex_array::ToCanonical;
15-
use vortex_array::arrays::MaskedArray;
16-
use vortex_array::arrays::StructArray;
13+
use vortex_array::arrays::ScalarFnArray;
14+
use vortex_array::arrays::ScalarFnVTable;
1715
use vortex_array::builtins::ArrayBuiltins;
1816
use vortex_array::expr::ExactExpr;
1917
use vortex_array::expr::Expression;
@@ -26,8 +24,6 @@ use vortex_array::expr::transform::PartitionedExpr;
2624
use vortex_array::expr::transform::partition;
2725
use vortex_array::expr::transform::replace;
2826
use vortex_array::expr::transform::replace_root_fields;
29-
use vortex_array::validity::Validity;
30-
use vortex_array::vtable::ValidityHelper;
3127
use vortex_dtype::DType;
3228
use vortex_dtype::FieldMask;
3329
use vortex_dtype::FieldName;
@@ -349,18 +345,17 @@ impl LayoutReader for StructReader {
349345

350346
// If root expression was a pack, then we apply the validity to each child field
351347
if is_pack_merge {
352-
let struct_array = array.to_struct();
353-
let masked_fields: Vec<ArrayRef> = struct_array
354-
.fields()
355-
.iter()
348+
let array = array.as_::<ScalarFnVTable>();
349+
let masked_children: Vec<ArrayRef> = array
350+
.children()
351+
.into_iter()
356352
.map(|a| a.mask(&validity))
357353
.try_collect()?;
358354

359-
Ok(StructArray::try_new(
360-
struct_array.names().clone(),
361-
masked_fields,
362-
struct_array.len(),
363-
struct_array.validity().clone(),
355+
Ok(ScalarFnArray::try_new(
356+
array.scalar_fn().clone(),
357+
masked_children,
358+
array.len(),
364359
)?
365360
.into_array())
366361
} else {

0 commit comments

Comments
 (0)