zeroshade commented on issue #41284:
URL: https://github.com/apache/arrow/issues/41284#issuecomment-2100866694

   @candiduslynx I'm very confused by that file, it looks like you're using a 
builder to make a deep copy of the arrays which doesn't make any sense to me. 
   
   You have this function:
   
   ```go
   func slice(r arrow.Record) []arrow.Record {
        res := make([]arrow.Record, r.NumRows())
        for i := int64(0); i < r.NumRows(); i++ {
                res[i] = r.NewSlice(i, i+1)
        }
        return res
   }
   ```
   If I'm reading this right, you're slicing the record int a slice of records 
of exactly 1 row each? Why? 
   
   But I'm more confused by this `reverseTransformArray` function. 
`reverseTransformRecord` appears to loop through the columns and call 
`reverseTransformArray` with each column's type and the column itself. Which 
means that `reverseTransformArray` is receiving a datatype which is always 
identical to the datatype of the Array being passed in. This means that 
something like `reverseTransformFromString` is always called with a string 
array. So you're creating a builder and building up a new array which is 
*identical* to the one that was passed in rather than just calling `.Retain()` 
on the array and returning the same array that was passed in or using the 
`.Copy` method on the `ArrayData` object and then using `MakeFromData`. If you 
*really* wanted to make a deep copy (but why??), you could do it in a generic 
way by explicitly copying the buffers regardless of the type to create new 
ArrayData objects.
   
   >  offset should also be used (as the passed in record/array may be sliced), 
but not for struct arrays (they are special & I don't know why).
   
   What do you mean "special"? The offset handling for struct arrays should 
work precisely the same as any other type. Can you elaborate on what the issue 
there is?


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