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


##########
go/arrow/schema.go:
##########
@@ -194,7 +194,11 @@ func (sc *Schema) WithEndianness(e endian.Endianness) 
*Schema {
 func (sc *Schema) Endianness() endian.Endianness { return sc.endianness }
 func (sc *Schema) IsNativeEndian() bool          { return sc.endianness == 
endian.NativeEndian }
 func (sc *Schema) Metadata() Metadata            { return sc.meta }
-func (sc *Schema) Fields() []Field               { return sc.fields }
+func (sc *Schema) Fields() []Field { 
+       fields := make([]Field, len(sc.fields))
+       copy(fields, sc.fields)
+       return fields
+}

Review Comment:
   I'm not sure I like this. From a performance standpoint, I'd prefer to 
return the slice as-is rather than a copy of the slice. Perhaps we should add a 
new function like `FieldsCopy()` or something to that end?



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