You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@arrow.apache.org by "hermanschaaf (via GitHub)" <gi...@apache.org> on 2023/04/07 10:37:41 UTC

[GitHub] [arrow] hermanschaaf opened a new issue, #34959: [Go] Support for casting to extension types

hermanschaaf opened a new issue, #34959:
URL: https://github.com/apache/arrow/issues/34959

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


-- 
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: issues-unsubscribe@arrow.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org