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 NullBufferBuilder::new_from_buffer wrong size assertion #5489

Merged
merged 2 commits into from
Mar 10, 2024
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
17 changes: 17 additions & 0 deletions arrow-array/src/array/primitive_array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2564,4 +2564,21 @@ mod tests {
let debug_str = format!("{:?}", array);
assert_eq!("PrimitiveArray<Time64(Microsecond)>\n[\n Cast error: Failed to convert -1 to temporal for Time64(Microsecond),\n 00:00:00,\n 23:59:59,\n Cast error: Failed to convert 86400000000 to temporal for Time64(Microsecond),\n Cast error: Failed to convert 86401000000 to temporal for Time64(Microsecond),\n null,\n]", debug_str);
}

#[test]
fn test_primitive_with_nulls_into_builder() {
let array: Int32Array = vec![
Some(1),
None,
Some(3),
Some(4),
None,
Some(7),
None,
Some(8),
]
.into_iter()
.collect();
let _ = array.into_builder();
}
}
2 changes: 1 addition & 1 deletion arrow-buffer/src/builder/null.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ impl NullBufferBuilder {
pub fn new_from_buffer(buffer: MutableBuffer, len: usize) -> Self {
let capacity = buffer.len() * 8;

assert!(len < capacity);
assert!(len <= capacity);

let bitmap_builder = Some(BooleanBufferBuilder::new_from_buffer(buffer, len));
Self {
Expand Down
Loading