zeroshade commented on code in PR #645:
URL: https://github.com/apache/arrow-go/pull/645#discussion_r2710111240


##########
arrow/schema.go:
##########
@@ -170,18 +170,17 @@ func NewSchema(fields []Field, metadata *Metadata) 
*Schema {
 
 func NewSchemaWithEndian(fields []Field, metadata *Metadata, e 
endian.Endianness) *Schema {
        sc := &Schema{
-               fields:     make([]Field, 0, len(fields)),
+               fields:     fields,

Review Comment:
   The only problem I see with this is that currently we explicitly do the copy 
to ensure that if the caller maintains a reference to the slice they can't 
modify the fields after calling this.
   
   By just putting the slice in there, then technically a caller could modify 
the slice afterwards and possibly screw up the schema. 
   
   Is copying the fields really causing that much memory allocations and 
leakage?



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