1fanwang opened a new issue, #10671:
URL: https://github.com/apache/arrow-rs/issues/10671
**Describe the bug**
`substring()` rejects the view types:
```
substring(Utf8View ) ERR: Compute error: substring does not support type
Utf8View
substring(BinaryView) ERR: Compute error: substring does not support type
BinaryView
substring(Dict<Utf8View>) ERR: Compute error: substring does not support
type Utf8View
```
It takes `Utf8`, `LargeUtf8`, `Binary`, `LargeBinary`, `FixedSizeBinary` and
`Dictionary`, so a caller holding `StringViewArray` has to cast to `Utf8`
first, which copies the data.
The other string kernels in the same crate already take views: `length`,
`bit_length`, `like` and `concat_elements` all have `DataType::Utf8View` arms.
`substring.rs` is the only file in `arrow-string/src` that handles `Utf8` and
never mentions `Utf8View`.
**To Reproduce**
```rust
use arrow_array::StringViewArray;
use arrow_string::substring::substring;
let array = StringViewArray::from(vec![Some("hello world")]);
let err = substring(&array, 0, Some(5)).unwrap_err();
assert_eq!(err.to_string(), "Compute error: substring does not support type
Utf8View");
```
**Expected behavior**
`substring` accepts `Utf8View` and `BinaryView` and returns the same values
the `Utf8` and `Binary` paths return for the same input, including for a
dictionary whose values are a view array.
**Additional context**
Not listed under #6163.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]