-
Notifications
You must be signed in to change notification settings - Fork 105
[Go] Support for casting to extension types #61
Copy link
Copy link
Open
Labels
Type: enhancementNew feature or requestNew feature or request
Description
Describe the enhancement requested
Right now it seems like there is support for casting from extension types to their underlying storage types, but not vice versa.
The cast_test.go tests include these cases, for example:
canCast(types.NewSmallintType(), []arrow.DataType{arrow.PrimitiveTypes.Int16})
canCast(types.NewSmallintType(), numericTypes) // any cast which is valid for storage is supported
canCast(arrow.Null, []arrow.DataType{types.NewSmallintType()})
But adding this case, from the storage type to the extension type, fails:
canCast(arrow.PrimitiveTypes.Int16, []arrow.DataType{types.NewSmallintType()}) // casting from storage type to extension is supported
=== RUN TestCasts/TestCanCast
cast_test.go:335:
Error Trace: /Users/hermanschaaf/code/cloudquery/arrow/go/arrow/compute/cast_test.go:335
/Users/hermanschaaf/code/cloudquery/arrow/go/arrow/compute/cast_test.go:341
/Users/hermanschaaf/code/cloudquery/arrow/go/arrow/compute/cast_test.go:401
Error: Not equal:
expected: true
actual : false
Test: TestCasts/TestCanCast
Messages: CanCast from: int16, to: extension_type<storage=int16>, expected: true
It seems like this should be possible, as long as the type being cast from matches the storage type. Is there another way to do this that I might be missing?
Component(s)
Go
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Type: enhancementNew feature or requestNew feature or request