chriscasola commented on code in PR #35723:
URL: https://github.com/apache/arrow/pull/35723#discussion_r1210672435
##########
go/arrow/array/string.go:
##########
@@ -79,16 +79,12 @@ func (a *String) ValueOffsets() []int32 {
return a.offsets[beg:end]
}
-func (a *String) ValueBytes() (ret []byte) {
+func (a *String) ValueBytes() []byte {
beg := a.array.data.offset
end := beg + a.array.data.length
data := a.values[a.offsets[beg]:a.offsets[end]]
- s := (*reflect.SliceHeader)(unsafe.Pointer(&ret))
- s.Data = (*reflect.StringHeader)(unsafe.Pointer(&data)).Data
- s.Len = len(data)
- s.Cap = len(data)
- return
+ return []byte(data)
Review Comment:
Yes we changed this because of the `SliceHeader` issue.
When would this cause a copy? Aren't we slicing the string which is
referencing the same underlying data?
--
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]