Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Utf8View in arrow_string::length #6305

Closed
Omega359 opened this issue Aug 24, 2024 · 2 comments · Fixed by #6345
Closed

Add support for Utf8View in arrow_string::length #6305

Omega359 opened this issue Aug 24, 2024 · 2 comments · Fixed by #6345
Assignees
Labels
enhancement Any new improvement worthy of a entry in the changelog

Comments

@Omega359
Copy link
Contributor

Is your feature request related to a problem or challenge? Please describe what you are trying to do.

This came up as a result of a bug report in DataFusion: apache/datafusion#12149 where length(StringViewArray) throws an error.

Describe the solution you'd like

The length function has StringViewArray support added and tests added to cover this case.

Describe alternatives you've considered

Additional context

@Omega359 Omega359 added the enhancement Any new improvement worthy of a entry in the changelog label Aug 24, 2024
@Omega359 Omega359 changed the title Add support for StringView in arrow_string::length Add support for Utf8View in arrow_string::length Aug 24, 2024
@Omega359
Copy link
Contributor Author

I suspect a simple implementation would be

DataType::Utf8View => {
            let list = array.as_string_view();
            let v = list.views().iter().map(|v| *v as i32).collect::<Vec<_>>();
            Ok(Arc::new(PrimitiveArray::<Int32Type>::new(v.into(), list.nulls().cloned())))
        }
``` 
however I don't know if that would perform as best as possible.    

@Omega359
Copy link
Contributor Author

Omega359 commented Sep 1, 2024

take

Omega359 added a commit to Omega359/arrow-rs that referenced this issue Sep 1, 2024
alamb pushed a commit that referenced this issue Sep 9, 2024
* Add support for Utf8View in arrow_string::length #6305

* Cargo fmt.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Any new improvement worthy of a entry in the changelog
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant