You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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: apache/arrow#43302
I tested this in Python and it works with the latest (18.0.0) pyarrow release:
[ins] In [1]: importpyarrowaspa
[ins] In [2]: importpyarrow.computeaspc
[ins] In [3]: a=pa.array(["one", "two", "three"])
[ins] In [4]: aOut[4]:
<pyarrow.lib.StringArrayobjectat0x111e3b340>
[
"one",
"two",
"three"
]
[ins] In [5]: a.cast(pa.string_view())
Out[5]:
<pyarrow.lib.StringViewArrayobjectat0x111a3be80>
[
"one",
"two",
"three"
]
It doesn't work with the v18 release of arrow-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"
)
funcmain() {
alloc:=memory.NewGoAllocator()
b:=array.NewStringBuilder(alloc)
deferb.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,
})
iferr!=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
The text was updated successfully, but these errors were encountered:
The kernels set up here based on the output type, by calling addToBinaryKernels to add the appropriate casting kernels for String/LargeString/Binary/LargeBinary by using generics. 3. You'll need to create a new function for casting to StringView/BinaryView since they don't have "Large" variants like String and Binary (for example, notice that there are separate Cast*Fsb* functions for handling Fixed Size Binary types). You could then add it to the kernels appended by addToBinaryKernels in the same way as we do for fixed-size-binary.
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: apache/arrow#43302
I tested this in Python and it works with the latest (18.0.0) pyarrow release:
It doesn't work with the v18 release of arrow-go:
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
The text was updated successfully, but these errors were encountered: