Skip to content

Commit a13a0ed

Browse files
authored
Avoid redundant chunk execution in pack_struct_chunks (#6682)
`pack_struct_chunks` was calling `execute::<StructArray>` once per field per chunk, when each chunk only needs to be decoded once. Signed-off-by: Baris Palaska <barispalaska@gmail.com>
1 parent 6c7cd94 commit a13a0ed

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

vortex-array/src/arrays/chunked/vtable/canonical.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,14 @@ fn pack_struct_chunks(
7171
let len = chunks.iter().map(|chunk| chunk.len()).sum();
7272
let mut field_arrays = Vec::new();
7373

74+
let executed_chunks: Vec<StructArray> = chunks
75+
.iter()
76+
.map(|c| c.clone().execute::<StructArray>(ctx))
77+
.collect::<VortexResult<_>>()?;
78+
7479
for (field_idx, field_dtype) in struct_dtype.fields().enumerate() {
7580
let mut field_chunks = Vec::with_capacity(chunks.len());
76-
for c in chunks {
77-
let struct_array = c.clone().execute::<StructArray>(ctx)?;
81+
for struct_array in &executed_chunks {
7882
let field = struct_array
7983
.unmasked_fields()
8084
.get(field_idx)

0 commit comments

Comments
 (0)