emkornfield commented on a change in pull request #10203:
URL: https://github.com/apache/arrow/pull/10203#discussion_r630315454



##########
File path: go/arrow/compare.go
##########
@@ -46,34 +46,45 @@ func TypeEqual(left, right DataType, opts 
...TypeEqualOption) bool {
 
        switch {
        case left == nil || right == nil:
-               return false
+               return left == nil && right == nil
        case left.ID() != right.ID():
                return false
        }
 
-       // StructType is the only type that has metadata.
-       l, ok := left.(*StructType)
-       if !ok || cfg.metadata {
-               return reflect.DeepEqual(left, right)
-       }
-
-       r := right.(*StructType)
-       switch {
-       case len(l.fields) != len(r.fields):
-               return false
-       case !reflect.DeepEqual(l.index, r.index):
-               return false
-       }
-       for i := range l.fields {
-               leftField, rightField := l.fields[i], r.fields[i]
-               switch {
-               case leftField.Name != rightField.Name:
+       switch l := left.(type) {
+       case ExtensionType:
+               return l.ExtensionEquals(right.(ExtensionType))
+       case *ListType:
+               if !TypeEqual(l.Elem(), right.(*ListType).Elem(), opts...) {
                        return false
-               case leftField.Nullable != rightField.Nullable:
+               }
+               if cfg.metadata {
+                       return l.Meta.Equal(right.(*ListType).Meta)
+               }
+               return true
+       case *StructType:
+               r := right.(*StructType)
+               switch {
+               case len(l.fields) != len(r.fields):
                        return false
-               case !TypeEqual(leftField.Type, rightField.Type, opts...):
+               case !reflect.DeepEqual(l.index, r.index):

Review comment:
       what is the scope of reflect.DeepEqual, i'm wondering if there are 
chances transient data might cause false negatives.




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

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to