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


##########
go/arrow/datatype_nested.go:
##########
@@ -490,7 +495,12 @@ func (t *unionType) init(fields []Field, typeCodes 
[]UnionTypeCode) {
        }
 }
 
-func (t unionType) Fields() []Field            { return t.children }
+func (t unionType) Fields() []Field {
+       fields := make([]Field, len(t.children))
+       copy(fields, t.children)
+       return fields
+}

Review Comment:
   same here. add a godoc comment to this to indicate it makes a copy of the 
fields



##########
go/arrow/datatype_nested.go:
##########
@@ -288,7 +288,12 @@ func (t *StructType) String() string {
        return o.String()
 }
 
-func (t *StructType) Fields() []Field   { return t.fields }
+func (t *StructType) Fields() []Field {

Review Comment:
   Can you add a godoc comment on the methods to indicate to callers that this 
will make a copy of the Fields?



-- 
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: [email protected]

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

Reply via email to