You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "tobixdev (via GitHub)" <gi...@apache.org> on 2025/11/26 09:08:24 UTC
[PR] Allow creating zero-sized FixedSizeBinary arrays [arrow-rs]
tobixdev opened a new pull request, #8927:
URL: https://github.com/apache/arrow-rs/pull/8927
# Which issue does this PR close?
- Closes #8926 .
Note that creating sch arrays was already possible with the builder API (see `test_fixed_size_binary_builder_with_zero_value_length`) but not directly with the Array API.
# Rationale for this change
Avoid panicking in `FixedSizeBinaryArray::try_new(0, ...)`
# What changes are included in this PR?
Special case for `size == 0` in `FixedSizeBinaryArray::try_new`.
# Are these changes tested?
Yes, additional constructor tests.
# Are there any user-facing changes?
Yes, no panics and the ability to directly create FSB arrays with zero-length items.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Allow creating zero-sized FixedSizeBinary arrays [arrow-rs]
Posted by "Jefffrey (via GitHub)" <gi...@apache.org>.
Jefffrey merged PR #8927:
URL: https://github.com/apache/arrow-rs/pull/8927
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Allow creating zero-sized FixedSizeBinary arrays [arrow-rs]
Posted by "Jefffrey (via GitHub)" <gi...@apache.org>.
Jefffrey commented on code in PR #8927:
URL: https://github.com/apache/arrow-rs/pull/8927#discussion_r2564970805
##########
arrow-array/src/array/fixed_size_binary_array.rs:
##########
@@ -1002,10 +1016,26 @@ mod tests {
);
let nulls = NullBuffer::new_null(3);
- let err = FixedSizeBinaryArray::try_new(2, buffer, Some(nulls)).unwrap_err();
+ let err = FixedSizeBinaryArray::try_new(2, buffer.clone(), Some(nulls)).unwrap_err();
assert_eq!(
err.to_string(),
"Invalid argument error: Incorrect length of null buffer for FixedSizeBinaryArray, expected 5 got 3"
);
+
+ let zero_sized = FixedSizeBinaryArray::new(0, Buffer::default(), None);
+ assert_eq!(zero_sized.len(), 0);
+
+ let nulls = NullBuffer::new_null(3);
+ let zero_sized_with_nulls = FixedSizeBinaryArray::new(0, Buffer::default(), Some(nulls));
+ assert_eq!(zero_sized_with_nulls.len(), 3);
+
+ let zero_sized_with_non_empty_buffer = FixedSizeBinaryArray::try_new(0, buffer, None);
+ assert!(
+ matches!(
+ zero_sized_with_non_empty_buffer,
Review Comment:
Perhaps assert the contents of the string as is done above (`err.to_string()`)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Allow creating zero-sized FixedSizeBinary arrays [arrow-rs]
Posted by "Jefffrey (via GitHub)" <gi...@apache.org>.
Jefffrey commented on PR #8927:
URL: https://github.com/apache/arrow-rs/pull/8927#issuecomment-3590821583
Thanks @tobixdev
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org