Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Subtraction with underflow on empty FixedSizeBinaryArray #20109

Merged
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
13 changes: 8 additions & 5 deletions crates/polars-compute/src/cast/binary_to.rs
Original file line number Diff line number Diff line change
Expand Up @@ -202,12 +202,15 @@ pub fn fixed_size_binary_to_binview(from: &FixedSizeBinaryArray) -> BinaryViewAr
// This is zero-copy for the buffer since split just increases the data since
let mut buffer = from.values().clone();
let mut buffers = Vec::with_capacity(num_buffers);
for _ in 0..num_buffers - 1 {
let slice;
(slice, buffer) = buffer.split_at(split_point);
buffers.push(slice);

if let Some(num_buffers) = num_buffers.checked_sub(1) {
for _ in 0..num_buffers {
let slice;
(slice, buffer) = buffer.split_at(split_point);
buffers.push(slice);
}
buffers.push(buffer);
}
buffers.push(buffer);

let mut iter = from.values_iter();
let iter = iter.by_ref();
Expand Down
Loading