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


##########
go/arrow/array/dictionary.go:
##########
@@ -1293,6 +1293,41 @@ func (b *BinaryDictionaryBuilder) 
InsertStringDictValues(arr *String) (err error
        return
 }
 
+func (b *BinaryDictionaryBuilder) GetValueIndex(i int) int {
+       switch b := b.idxBuilder.Builder.(type) {
+       case *Uint8Builder:
+               return int(b.Value(i))
+       case *Int8Builder:
+               return int(b.Value(i))
+       case *Uint16Builder:
+               return int(b.Value(i))
+       case *Int16Builder:
+               return int(b.Value(i))
+       case *Uint32Builder:
+               return int(b.Value(i))
+       case *Int32Builder:
+               return int(b.Value(i))
+       case *Uint64Builder:
+               return int(b.Value(i))
+       case *Int64Builder:
+               return int(b.Value(i))
+       default:
+               return -1
+       }
+}
+
+func (b *BinaryDictionaryBuilder) Value(i int) []byte {
+       switch mt := b.memoTable.(type) {
+       case *hashing.BinaryMemoTable:
+               return mt.Value(i)
+       }
+       return nil
+}
+
+func (b *BinaryDictionaryBuilder) ValueStr(i int) string {
+       return string(b.Value(i))

Review Comment:
   `return *(*string)(unsafe.Pointer(&b))` will return the string without 
copying the bytes. :smile:



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