Skip to content

Commit bfbc5bb

Browse files
fix(layout): normalize rebuilt list-view children before writing
Signed-off-by: Christopher Wirt <[email protected]>
1 parent 7d29190 commit bfbc5bb

2 files changed

Lines changed: 8 additions & 6 deletions

File tree

‎vortex-layout/src/layouts/list/reader.rs‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2202,6 +2202,7 @@ mod tests {
22022202
#[case::two_cuts(&[1, 3], false, false)]
22032203
#[case::null_and_empty_at_cuts(&[1, 3], true, false)]
22042204
#[case::list_view_chunks(&[1, 3], true, true)]
2205+
#[case::non_nullable_list_view_chunks(&[1, 3], false, true)]
22052206
#[tokio::test]
22062207
async fn sliced_list_chunks_round_trip(
22072208
#[case] cuts: &[usize],

‎vortex-layout/src/layouts/list/writer.rs‎

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -295,15 +295,16 @@ fn canonicalize_to_list_parts(
295295
exec_ctx: &mut ExecutionCtx,
296296
) -> VortexResult<ListDataParts> {
297297
let canonical = array.execute_until::<AnyList>(exec_ctx)?;
298-
if let Some(list) = canonical.as_opt::<List>() {
299-
// A sliced list keeps its parent's whole `elements`, but `global_offsets` assumes each
300-
// chunk's offsets span exactly `[0, elements.len()]`.
301-
Ok(list.reset_offsets(false, exec_ctx)?.into_data_parts())
298+
let list = if let Some(list) = canonical.as_opt::<List>() {
299+
list.into_owned()
302300
} else if let Some(view) = canonical.as_opt::<ListView>() {
303-
Ok(list_from_list_view(view.into_owned(), exec_ctx)?.into_data_parts())
301+
list_from_list_view(view.into_owned(), exec_ctx)?
304302
} else {
305303
unreachable!("AnyList matcher guarantees List or ListView")
306-
}
304+
};
305+
// Sliced lists can retain unused elements, and rebuilding a list view can leave a lazy
306+
// elements slice. Normalize both before passing their children to serializing strategies.
307+
Ok(list.reset_offsets(false, exec_ctx)?.into_data_parts())
307308
}
308309

309310
/// Rebase a chunk's local `offsets` into global `u64` positions for the whole-column `offsets`

0 commit comments

Comments
 (0)