Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions vortex-layout/src/layouts/list/reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2202,6 +2202,7 @@ mod tests {
#[case::two_cuts(&[1, 3], false, false)]
#[case::null_and_empty_at_cuts(&[1, 3], true, false)]
#[case::list_view_chunks(&[1, 3], true, true)]
#[case::non_nullable_list_view_chunks(&[1, 3], false, true)]
#[tokio::test]
async fn sliced_list_chunks_round_trip(
#[case] cuts: &[usize],
Expand Down
13 changes: 7 additions & 6 deletions vortex-layout/src/layouts/list/writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -295,15 +295,16 @@ fn canonicalize_to_list_parts(
exec_ctx: &mut ExecutionCtx,
) -> VortexResult<ListDataParts> {
let canonical = array.execute_until::<AnyList>(exec_ctx)?;
if let Some(list) = canonical.as_opt::<List>() {
// A sliced list keeps its parent's whole `elements`, but `global_offsets` assumes each
// chunk's offsets span exactly `[0, elements.len()]`.
Ok(list.reset_offsets(false, exec_ctx)?.into_data_parts())
let list = if let Some(list) = canonical.as_opt::<List>() {
list.into_owned()
} else if let Some(view) = canonical.as_opt::<ListView>() {
Ok(list_from_list_view(view.into_owned(), exec_ctx)?.into_data_parts())
list_from_list_view(view.into_owned(), exec_ctx)?
} else {
unreachable!("AnyList matcher guarantees List or ListView")
}
};
// Sliced lists can retain unused elements, and rebuilding a list view can leave a lazy
// elements slice. Normalize both before passing their children to serializing strategies.
Ok(list.reset_offsets(false, exec_ctx)?.into_data_parts())
}

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