tobixdev opened a new issue, #8900:
URL: https://github.com/apache/arrow-rs/issues/8900

   **Describe the bug**
   
   The function `FixedSizeBinaryArray::new_null` aims to create a new 
`FixedSizeBinaryArray` with all null values. But instead of creating a 
`MutableBuffer` with the expected size, it creates a `MutableBuffer` with the 
expected capacity, leaving the length of the buffer 0.
   
   As the fixed size binary array is a [fixed size primitive 
array](https://arrow.apache.org/docs/format/Columnar.html#fixed-size-primitive-layout)
 I'd expect the values to buffer to have at least `len * value_len` bytes. This 
is not the case as the resulting buffer will have a length of zero (even though 
the capacity would be there).
   
   **To Reproduce**
   
   ```rust
   let null_array = FixedSizeBinaryArray::new_null(4, 3);
   assert_eq!(null_array.len(), 3);
   assert_eq!(null_array.values().len(), 12);
   ```
   
   `null_array.values().len()` return 0 instead of 12
   
   **Expected behavior**
   
   Actually allocate a buffer with the expected length, not just capacity.
   
   **Additional context**
   
   I stumbled across this while investigating 
https://github.com/apache/datafusion/issues/18870


-- 
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]

Reply via email to