Sunyue opened a new issue, #424:
URL: https://github.com/apache/arrow-go/issues/424

   ### Describe the enhancement requested
   
   When trying to cast float16 array to float32/float64 using 
`compute.CastToType()`, I am getting error `not implemented: function 
'cast_float' has no kernel matching input types (float16)`. I tried a few other 
types which are also not possible.
   
   Is it feasible to support casting from float16 in function 
`compute.CastToType()`? Thanks!
   
   
   ```go
   import (
        "testing"
   
        "github.com/apache/arrow-go/v18/arrow"
        "github.com/apache/arrow-go/v18/arrow/array"
        "github.com/apache/arrow-go/v18/arrow/compute"
        "github.com/apache/arrow-go/v18/arrow/float16"
        "github.com/apache/arrow-go/v18/arrow/memory"
        "github.com/stretchr/testify/require"
   )
   
   func Test_Types(t *testing.T) {
        t.Parallel()
   
        tt := []struct {
                name string
                to   arrow.DataType
        }{
                {
                        name: "float32",
                        to:   arrow.PrimitiveTypes.Float32,
                },
                {
                        name: "float64",
                        to:   arrow.PrimitiveTypes.Float64,
                },
        }
   
        for _, tc := range tt {
                t.Run(tc.name, func(t *testing.T) {
                        t.Parallel()
   
                        ctx := t.Context()
                        rq := require.New(t)
   
                        builder := 
array.NewFloat16Builder(memory.DefaultAllocator)
                        defer builder.Release()
   
                        builder.AppendValues([]float16.Num{float16.New(1.1), 
float16.New(2.2), float16.New(3.3)}, nil)
                        arr := builder.NewArray()
   
                        defer arr.Release()
   
                        _, err := compute.CastToType(ctx, arr, tc.to)
                        rq.NoError(err, "failed to cast from float16 to %q", 
tc.to.Name())
                })
        }
   }
   ```
   
   
   
   ### 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: issues-unsubscr...@arrow.apache.org.apache.org

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

Reply via email to