You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "izveigor (via GitHub)" <gi...@apache.org> on 2023/04/22 14:55:49 UTC

[GitHub] [arrow-rs] izveigor opened a new issue, #4110: Equality of nested data types

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: github-unsubscribe@arrow.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow-rs] tustvold closed issue #4110: Equality of nested data types

Posted by "tustvold (via GitHub)" <gi...@apache.org>.
tustvold closed issue #4110: Equality of nested data types
URL: https://github.com/apache/arrow-rs/issues/4110


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow-rs] tustvold commented on issue #4110: Equality of nested data types

Posted by "tustvold (via GitHub)" <gi...@apache.org>.
tustvold commented on issue #4110:
URL: https://github.com/apache/arrow-rs/issues/4110#issuecomment-1536259253

   `label_issue.py` automatically added labels {'arrow'} from #4111


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org