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

   ### Describe the bug, including details regarding any error messages, 
version, and platform.
   
   Casting between string <-> string_view types has been added in C++ and 
Python implementations of arrow in v18: 
https://github.com/apache/arrow/pull/43302
   
   I tested this in Python and it works with the latest (18.0.0) pyarrow 
release:
   
   ```python
   [ins] In [1]: import pyarrow as pa
   
   [ins] In [2]: import pyarrow.compute as pc
   
   [ins] In [3]: a = pa.array(["one", "two", "three"])
   
   [ins] In [4]: a
   Out[4]: 
   <pyarrow.lib.StringArray object at 0x111e3b340>
   [
     "one",
     "two",
     "three"
   ]
   
   [ins] In [5]: a.cast(pa.string_view())
   Out[5]: 
   <pyarrow.lib.StringViewArray object at 0x111a3be80>
   [
     "one",
     "two",
     "three"
   ]
   ```
   
   It doesn't work with the v18 release of arrow-go:
   
   ```go
   package main
   
   import (
        "context"
        "fmt"
   
        "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/memory"
   )
   
   func main() {
        alloc := memory.NewGoAllocator()
        b := array.NewStringBuilder(alloc)
        defer b.Release()
        b.AppendValues([]string{"a", "b", "c"}, nil)
        arr := b.NewArray()
        fmt.Println(arr)
   
        newArr, err := compute.CastArray(context.Background(), arr, 
&compute.CastOptions{
                ToType: arrow.BinaryTypes.StringView,
        })
        if err != nil {
                panic(err)
        }
        fmt.Println(newArr)
   }
   
   // Output:
   // ["a" "b" "c"]
   // panic: not implemented: unsupported cast to string_view from utf8
   // ...
   // exit status 2
   ```
   
   I'd be happy to work on the PR to add it if someone can give me a pointer 
with description of what would it take - high-level - to add support for this 
in Go.
   
   ### Component(s)
   
   Release


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