tobixdev commented on PR #18903:
URL: https://github.com/apache/datafusion/pull/18903#issuecomment-3569698062
Hmm seems this change causes problems with `DataType::FixedSizeBinary(0)` as
it divides by zero in `FixedSizeBinaryArray::try_new`.
```rust
/// Create a new [`FixedSizeBinaryArray`] from the provided parts,
returning an error on failure
///
/// # Errors
///
/// * `size < 0`
/// * `values.len() / size != nulls.len()`
pub fn try_new(
size: i32,
values: Buffer,
nulls: Option<NullBuffer>,
) -> Result<Self, ArrowError> {
let data_type = DataType::FixedSizeBinary(size);
let s = size.to_usize().ok_or_else(|| {
ArrowError::InvalidArgumentError(format!("Size cannot be
negative, got {size}"))
})?;
let len = values.len() / s; <--- crash
```
I don't see any way to create a new `FixedSizeBinaryArray` with zero length
using `try_new`. Is this on-purpose? The comments says 0 should be fine. Is
this a bug in arrow-rs?
We maybe could create a `FixedSizeBinaryArray` using the `From<ArrayData>`
implementation.
Any preferences on how we should proceed? As I am unsure whether we even
want to fix this issue on the DataFusion side (or wait for an arrow-rs update),
I'll wait another opinion.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]