Skip to content

Commit c4b40e3

Browse files
authored
handle null views correctly on varbinview compaction (#5279)
1 parent a9b602a commit c4b40e3

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

vortex-array/src/builders/varbinview.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -695,6 +695,13 @@ impl PrecomputedViewAdjustment {
695695
.as_ref()
696696
.map(|o| o[b_idx as usize])
697697
.unwrap_or_default();
698+
699+
// If offset < offset_shift, this view was invalid and wasn't counted in buffer_utilizations.
700+
// Return an empty view to match how invalid views are handled in the Rewriting path.
701+
if view_ref.offset < offset_shift {
702+
return BinaryView::empty_view();
703+
}
704+
698705
view_ref
699706
.with_buffer_and_offset(b_idx + buffer_offset, view_ref.offset - offset_shift)
700707
}
@@ -708,6 +715,13 @@ impl PrecomputedViewAdjustment {
708715
.as_ref()
709716
.map(|o| o[b_idx as usize])
710717
.unwrap_or_default();
718+
719+
// If offset < offset_shift, this view was invalid and wasn't counted in buffer_utilizations.
720+
// Return an empty view to match how invalid views are handled in the Rewriting path.
721+
if view_ref.offset < offset_shift {
722+
return BinaryView::empty_view();
723+
}
724+
711725
view_ref.with_buffer_and_offset(buffer, view_ref.offset - offset_shift)
712726
}
713727
}

0 commit comments

Comments
 (0)