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

   **Describe the bug**
   The function `equals_datatype` checks the field name of data types 
`Dictionary`, `RunEndEncoded`, `Union` and `Map`. Like other nested data types, 
they shouldn't do this.
   
   **To Reproduce**
   ```
   use arrow::datatypes::{DataType, Field, UnionFields, UnionMode};
   use std::sync::Arc;
   
   fn main() {
       assert!(
           &DataType::List(Field::new("a", DataType::Int64, 
true).into()).equals_datatype(
               &DataType::List(Field::new("b", DataType::Int64, true).into())
           )
       );
   
       assert!(
           &DataType::Map(Arc::new(Field::new("a", DataType::Int64, true)), 
true).equals_datatype(
               &DataType::Map(Arc::new(Field::new("a", DataType::Int64, true)), 
true)
           )
       );
   
       assert!(!&DataType::Dictionary(
           Box::new(DataType::UInt8),
           Box::new(DataType::List(
               Field::new("a", DataType::Int64, true).into()
           ))
       )
       .equals_datatype(&DataType::Dictionary(
           Box::new(DataType::UInt8),
           Box::new(DataType::List(
               Field::new("b", DataType::Int64, true).into()
           ))
       )));
       assert!(!&DataType::RunEndEncoded(
           Arc::new(Field::new("aa", DataType::Int64, true)),
           Arc::new(Field::new("ab", DataType::Utf8, true))
       )
       .equals_datatype(&DataType::RunEndEncoded(
           Arc::new(Field::new("ba", DataType::Int64, true)),
           Arc::new(Field::new("bb", DataType::Utf8, true))
       )));
       assert!(!&DataType::Union(
           UnionFields::new(
               vec![1, 2],
               vec![
                   Field::new("field1", DataType::UInt8, false),
                   Field::new("field2", DataType::Utf8, false),
               ],
           ),
           UnionMode::Sparse,
       )
       .equals_datatype(&DataType::Union(
           UnionFields::new(
               vec![1, 2],
               vec![
                   Field::new("field3", DataType::UInt8, false),
                   Field::new("field4", DataType::Utf8, false),
               ],
           ),
           UnionMode::Sparse,
       )));
   }
   ```
   
   **Expected behavior**
   ```
   use arrow::datatypes::{DataType, Field, UnionFields, UnionMode};
   use std::sync::Arc;
   
   fn main() {
       assert!(
           &DataType::List(Field::new("a", DataType::Int64, 
true).into()).equals_datatype(
               &DataType::List(Field::new("b", DataType::Int64, true).into())
           )
       );
   
       assert!(
           !&DataType::Map(Arc::new(Field::new("a", DataType::Int64, true)), 
true).equals_datatype(
               &DataType::Map(Arc::new(Field::new("b", DataType::Int64, true)), 
true)
           )
       );
   
       assert!(&DataType::Dictionary(
           Box::new(DataType::UInt8),
           Box::new(DataType::List(
               Field::new("a", DataType::Int64, true).into()
           ))
       )
       .equals_datatype(&DataType::Dictionary(
           Box::new(DataType::UInt8),
           Box::new(DataType::List(
               Field::new("b", DataType::Int64, true).into()
           ))
       )));
       assert!(&DataType::RunEndEncoded(
           Arc::new(Field::new("aa", DataType::Int64, true)),
           Arc::new(Field::new("ab", DataType::Utf8, true))
       )
       .equals_datatype(&DataType::RunEndEncoded(
           Arc::new(Field::new("ba", DataType::Int64, true)),
           Arc::new(Field::new("bb", DataType::Utf8, true))
       )));
       assert!(&DataType::Union(
           UnionFields::new(
               vec![1, 2],
               vec![
                   Field::new("field1", DataType::UInt8, false),
                   Field::new("field2", DataType::Utf8, false),
               ],
           ),
           UnionMode::Sparse,
       )
       .equals_datatype(&DataType::Union(
           UnionFields::new(
               vec![1, 2],
               vec![
                   Field::new("field3", DataType::UInt8, false),
                   Field::new("field4", DataType::Utf8, false),
               ],
           ),
           UnionMode::Sparse,
       )));
   }
   ```
   
   **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