serramatutu commented on code in PR #758:
URL: https://github.com/apache/arrow-go/pull/758#discussion_r3078666313
##########
arrow/array/dictionary.go:
##########
@@ -990,6 +1030,26 @@ type dictBuilder[T arrow.ValueType] struct {
dictionaryBuilder
}
+func (b *dictBuilder[T]) UnsafeAppend(v T) error {
Review Comment:
NOTE: Since `Append()` returns `error`, I did the same thing for and
`UnsafeAppend()`. However the only thing that could return an error from
`appendValue`, `appendBytes` or `unsafeAppendValue` is
`b.memoTable.GetOrInsert(val)` since `val` is `interface{}` and the type ID
could be wrong.
However, here `v` is typed explicitly with `T`, so it is safe to assume
there should never be any error, unless there is an implementation bug, in
which case a panic is better.
IMO we should also change the API of `Append()`, but that would be a
breaking change.
What do you think?
##########
arrow/array/dictionary.go:
##########
@@ -990,6 +1030,26 @@ type dictBuilder[T arrow.ValueType] struct {
dictionaryBuilder
}
+func (b *dictBuilder[T]) UnsafeAppend(v T) error {
Review Comment:
NOTE: Since `Append()` returns `error`, I had done the same thing for and
`UnsafeAppend()`. However the only thing that could return an error from
`appendValue`, `appendBytes` or `unsafeAppendValue` is
`b.memoTable.GetOrInsert(val)` since `val` is `interface{}` and the type ID
could be wrong.
However, here `v` is typed explicitly with `T`, so it is safe to assume
there should never be any error, unless there is an implementation bug, in
which case a panic is better.
IMO we should also change the API of `Append()`, but that would be a
breaking change.
What do you think?
--
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]