-
Notifications
You must be signed in to change notification settings - Fork 85
Open
Labels
Type: enhancementNew feature or requestNew feature or request
Description
Describe the enhancement requested
Equal does not compare the metadata.
Lines 225 to 245 in 2900ed6
| // Equal returns whether two schema are equal. | |
| // Equal does not compare the metadata. | |
| func (sc *Schema) Equal(o *Schema) bool { | |
| switch { | |
| case sc == o: | |
| return true | |
| case sc == nil || o == nil: | |
| return false | |
| case len(sc.fields) != len(o.fields): | |
| return false | |
| case sc.endianness != o.endianness: | |
| return false | |
| } | |
| for i := range sc.fields { | |
| if !sc.fields[i].Equal(o.fields[i]) { | |
| return false | |
| } | |
| } | |
| return true | |
| } |
But Field.Equal does compare the metadata:
arrow-go/arrow/datatype_nested.go
Lines 956 to 968 in 2900ed6
| func (f Field) Equal(o Field) bool { | |
| switch { | |
| case f.Name != o.Name: | |
| return false | |
| case f.Nullable != o.Nullable: | |
| return false | |
| case !TypeEqual(f.Type, o.Type, CheckMetadata()): | |
| return false | |
| case !f.Metadata.Equal(o.Metadata): | |
| return false | |
| } | |
| return true | |
| } |
This is a little inconsistent. Ideally we would be able to choose how to compare. We could do the comparison ourselves but it's rather tedious, as we have to recurse into every type to find child fields. (Incidentally, if the DataType interface had a method to get the child fields (possibly empty) regardless of type, this would become much easier.)
Component(s)
Other
Metadata
Metadata
Assignees
Labels
Type: enhancementNew feature or requestNew feature or request