You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "chriscasola (via GitHub)" <gi...@apache.org> on 2023/05/30 18:33:38 UTC
[GitHub] [arrow] chriscasola commented on a diff in pull request #35723: GH-32832: [Go] support building with tinygo
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org