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

[GitHub] [arrow-rs] tustvold commented on a diff in pull request #4111: Ignore Field Metadata in equals_datatype for Dictionary, RunEndEncoded, Map and Union

tustvold commented on code in PR #4111:
URL: https://github.com/apache/arrow-rs/pull/4111#discussion_r1175586116


##########
arrow-schema/src/datatype.rs:
##########
@@ -664,6 +701,90 @@ mod tests {
         assert!(!list_h.equals_datatype(&list_j));
         assert!(!list_k.equals_datatype(&list_l));
         assert!(list_k.equals_datatype(&list_m));
+
+        let list_n =
+            DataType::Map(Arc::new(Field::new("f1", list_a.clone(), true)), true);
+        let list_o =
+            DataType::Map(Arc::new(Field::new("f2", list_b.clone(), true)), true);
+        let list_p =
+            DataType::Map(Arc::new(Field::new("f2", list_b.clone(), true)), false);
+        let list_q =
+            DataType::Map(Arc::new(Field::new("f2", list_c.clone(), true)), true);
+
+        assert!(list_n.equals_datatype(&list_o));
+        assert!(!list_n.equals_datatype(&list_p));
+        assert!(!list_n.equals_datatype(&list_q));
+
+        let list_r = DataType::Dictionary(Box::new(DataType::UInt8), Box::new(list_a));
+        let list_s =
+            DataType::Dictionary(Box::new(DataType::UInt8), Box::new(list_b.clone()));
+        let list_t = DataType::Dictionary(Box::new(DataType::Int8), Box::new(list_b));
+        let list_u = DataType::Dictionary(Box::new(DataType::UInt8), Box::new(list_c));
+
+        assert!(list_r.equals_datatype(&list_s));
+        assert!(!list_r.equals_datatype(&list_t));
+        assert!(!list_r.equals_datatype(&list_u));
+
+        let list_v = DataType::Union(

Review Comment:
   ```suggestion
           let union_a = DataType::Union(
   ```
   And same below



##########
arrow-schema/src/datatype.rs:
##########
@@ -628,10 +661,14 @@ mod tests {
         assert!(!list_b.equals_datatype(&list_c));

Review Comment:
   Could possibly add some tests for differing nullability



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