jorisvandenbossche opened a new issue, #34681:
URL: https://github.com/apache/arrow/issues/34681

   ### Describe the bug, including details regarding any error messages, 
version, and platform.
   
   From https://github.com/apache/arrow/issues/34634, which produces an invalid 
BooleanArray with a data buffer of size 0, when doing checking if this array is 
equal to another one, this incorrectly returns True:
   
   ```python
   >>> arr1 = pa.array([True, True])
   >>> arr2 = pc.replace_with_mask(pa.chunked_array([arr1]), [False, False], 
False).chunk(0)
   >>> arr1
   <pyarrow.lib.BooleanArray object at 0x7f8c8522f700>
   [
     true,
     true
   ]
   
   >>> arr2
   <pyarrow.lib.BooleanArray object at 0x7f8c843ce560>
   <Invalid array: Buffer #1 too small in array of type bool and length 2: 
expected at least 1 byte(s), got 0
   /home/joris/scipy/repos/arrow/cpp/src/arrow/array/validate.cc:116  
ValidateLayout(*data.type)>
   
   >>> arr1.equals(arr2)
   True
   ```
   
   It seems it only gives true when it actually matches what the invalid array 
should be (so maybe we were just writing anyway to (and reading from) 
non-properly allocated memory?)
   
   ```python
   >>> pa.array([True, True]).equals(arr2)
   True
   >>> pa.array([True, False]).equals(arr2)
   False
   ```
   
   While we should of course fix the root cause of producing such an invalid 
array (https://github.com/apache/arrow/issues/34634), it also doesn't help that 
_if_ you for some reason have such invalid array, it's possible to have 
`equals` work.
   
   ### Component(s)
   
   C++


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