zeroshade commented on code in PR #36015:
URL: https://github.com/apache/arrow/pull/36015#discussion_r1224669623


##########
go/arrow/datatype_nested.go:
##########
@@ -309,17 +309,28 @@ func (t *StructType) Fields() []Field {
 
 func (t *StructType) Field(i int) Field { return t.fields[i] }
 
+// FieldByName gets the field with the given name.
+//
+// If there are multiple fields with the given name, FieldByName
+// returns the first such field.
 func (t *StructType) FieldByName(name string) (Field, bool) {
        i, ok := t.index[name]
        if !ok {
                return Field{}, false
        }
-       return t.fields[i], true
+       return t.fields[i[0]], true
 }
 
+// FieldIdx gets the index of the field with the given name.
+//
+// If there are multiple fields with the given name, FieldIdx returns
+// the index of the first first such field.
 func (t *StructType) FieldIdx(name string) (int, bool) {
        i, ok := t.index[name]
-       return i, ok
+       if ok {
+               return i[0], true
+       }
+       return -1, false
 }

Review Comment:
   We should add a new method that will return the []int by name lookup



-- 
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-unsubscr...@arrow.apache.org

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

Reply via email to