-
Notifications
You must be signed in to change notification settings - Fork 825
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
Support StringViewArray interop with python: fix lingering C Data Interface issues for *ViewArray #6368
Conversation
Keeping this in draft until I can do some manual verification that it works |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @a10y -- this code looks great to me. I am not a low level expert in this area but I read it closely and it looks good. I found the code clear and easy to follow and the comments really helped. 🏆
I think the PR needs a few more tests (I commented on which below) but otherwise is ready to go.
@alamb I believe I've implemented all of the requested tests, thanks for reviewing! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me -- thank you @a10y
assert_eq!(mixed_one_variadic.data_buffers().len(), 1); | ||
run_test_case!(mixed_one_variadic); | ||
|
||
// inlined + non-inlined, 2 variadic buffers. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
} | ||
|
||
fn binary_view_column(num_variadic_buffers: usize) -> BinaryViewArray { | ||
let long_scalar = b"but soft what light through yonder window breaks".as_slice(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 nice choice
Thanks again @a10y |
Which issue does this PR close?
Closes #6366
Rationale for this change
Previously, StringViewArrays and BinaryViewArrays sent to PyArrow will panic.
If you use the updated
test_to_pyarrow()
from this PR without the additional changes, it will fail.What changes are included in this PR?
The specification states that the C Data Interface format for StringViewArray and BinaryViewArray includes an extra
variadic_buffer_sizes
buffer at the end of the various output values.We were not including that before. There was a prior PR to add it for the IPC format, but not for the C Data Interface.
I cribbed the relevant C++ code for this: https://github.com/apache/arrow/blob/ab0a40ee34217070f14027776682074c55d0b507/cpp/src/arrow/c/bridge.cc#L584-L609
Are there any user-facing changes?
It should now be possible to share StringViewArray and BinaryViewArray over C Data Interface.