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

   **Describe the bug**
   `<ListArray as PartialEq>::eq` returns `false` for two arrays of datatype 
`List(FixedSizeBinary(5))` containing identical values but physically differ.
   
   **To Reproduce**
   ```rust
   #[test]
   fn test_list_excess_children_equal() {
       let a_values = create_fixed_size_binary_array([Some(b"11111"), 
Some(b"22222"), None]);
       //                                             ^^^^^^^^^^^^^^  
^^^^^^^^^^^^^^^^^^^^
       //                                             a[0]            a[1]
       let a: ListArray = 
ArrayDataBuilder::new(DataType::List(Arc::new(Field::new(
           "item",
           a_values.data_type().clone(),
           true,
       ))))
       .len(2)
       .add_buffer(Buffer::from(vec![0i32, 1, 3].to_byte_slice()))
       .add_child_data(a_values.into_data())
       .null_bit_buffer(Some(Buffer::from(&[0b00000010])))
       .build()
       .unwrap()
       .into();
   
       let b_values = create_fixed_size_binary_array([Some(b"22222"), None]);
       //                                             ^^^^^^^^^^^^^^^^^^^^
       //                                             a[1]
       let b: ListArray = 
ArrayDataBuilder::new(DataType::List(Arc::new(Field::new(
           "item",
           b_values.data_type().clone(),
           true,
       ))))
       .len(2)
       .add_buffer(Buffer::from(vec![0i32, 0, 2].to_byte_slice()))
       .add_child_data(b_values.into_data())
       .null_bit_buffer(Some(Buffer::from(&[0b00000010])))
       .build()
       .unwrap()
       .into();
   
       a.to_data().validate_full().unwrap();
       b.to_data().validate_full().unwrap();
   
       assert_eq!(a, b);
   }
   
   // from `arrow/tests/array_equal.rs`
   fn create_fixed_size_binary_array<U: AsRef<[u8]>, T: AsRef<[Option<U>]>>(
       data: T,
   ) -> FixedSizeBinaryArray {
       let mut builder = 
FixedSizeBinaryBuilder::with_capacity(data.as_ref().len(), 5);
   
       for d in data.as_ref() {
           if let Some(v) = d {
               builder.append_value(v.as_ref()).unwrap();
           } else {
               builder.append_null();
           }
       }
       builder.finish()
   }
   ```
   
   ```
   thread 'test_list_excess_children_equal' panicked at 'assertion failed: 
`(left == right)`
     left: `ListArray
   [
     null,
     FixedSizeBinaryArray<5>
   [
     [50, 50, 50, 50, 50],
     null,
   ],
   ]`,
    right: `ListArray
   [
     null,
     FixedSizeBinaryArray<5>
   [
     [50, 50, 50, 50, 50],
     null,
   ],
   ]`', arrow\tests\array_equal.rs:399:5
   note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
   ```
   
   **Expected behavior**
   Returning `true` because they contain identical values, as shown by the 
debug printing
   
   **Additional context**
   <!--
   Add any other context about the problem here.
   -->


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