akehlenbeck opened a new issue, #516:
URL: https://github.com/apache/arrow-go/issues/516
### Describe the bug, including details regarding any error messages,
version, and platform.
Go 1.24.2 on linux/amd64
github.com/apache/arrow-go/v18 v18.4.1
The following program panics on a mismatch in `dictionaryBuilder` between
`arrow.Duration` and `int64`:
```
package main
import (
"fmt"
"github.com/apache/arrow-go/v18/arrow"
"github.com/apache/arrow-go/v18/arrow/array"
"github.com/apache/arrow-go/v18/arrow/memory"
)
func main() {
dictType := &arrow.DictionaryType{IndexType: &arrow.Int8Type{},
ValueType: arrow.FixedWidthTypes.Duration_ns}
bldr := array.NewDictionaryBuilder(memory.DefaultAllocator, dictType)
defer bldr.Release()
builder := bldr.(*array.DurationDictionaryBuilder)
if err := builder.Append(arrow.Duration(1)); err == nil {
fmt.Println("success")
} else {
fmt.Println(err)
}
}
```
Output:
```
panic: interface conversion: interface {} is arrow.Duration, not int64
goroutine 1 [running]:
github.com/apache/arrow-go/v18/internal/hashing.(*Table[...]).GetOrInsert(0x469039?,
{0x6622a0?, 0x73dd08?})
/home/.../go/pkg/mod/github.com/apache/arrow-go/[email protected]/internal/hashing/xxh3_memo_table_types.go:255
+0x49
github.com/apache/arrow-go/v18/arrow/array.(*dictionaryBuilder).appendValue(0xc0000b40e0,
{0x6622a0?, 0x73dd08?})
/home/.../go/pkg/mod/github.com/apache/arrow-go/[email protected]/arrow/array/dictionary.go:785
+0x2b
github.com/apache/arrow-go/v18/arrow/array.(*dictBuilder[...]).Append(...)
/home/.../go/pkg/mod/github.com/apache/arrow-go/[email protected]/arrow/array/dictionary.go:994
main.main()
/home/.../go/arrow-bug/main.go:17 +0x118
exit status 2
```
I am not particularly familiar with arrow-go but I believe the calling code
is valid, and that the construction of the internal MemoTable may be losing the
distinction between arrow.Duration and int64. The same problem may also exist
for a handful of other types but I didn't investigate closely.
(Please let me know if the calling code _isn't_ valid. The program above is
extracted from a complicated open-telemetry deployment that is panicking when
trying to use arrow on the wire; if something about the calling pattern above
is incorrect then I will have to go looking elsewhere for the problem.)
### Component(s)
Other
--
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]