metalmatze commented on code in PR #35744:
URL: https://github.com/apache/arrow/pull/35744#discussion_r1205852804
##########
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:
Just now, I saw that this actually allocates quite a lot of bytes...
For now, I have moved our code to use the `Value(i int) []byte` method above
and then using `bytes.Equal` to compared our to bytes converted string with
what we read from this builder.
Is there a better way you use to convert these bytes to strings in the arrow
project? I'm thinking of the
[yoloString](https://github.com/prometheus/prometheus/blob/cb045c0e4b94bbf3eee174d91b5ef2b8553948d5/model/textparse/promparse.go#L425)
Prometheus has.
--
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]