-
Notifications
You must be signed in to change notification settings - Fork 810
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
FFI implementation deviates from specification for array release #595
Comments
The same is true for schema release. As part of a fix, the allocated format, name, (and in the future: metadata, dictionary) should also go into private data. However, currently the code has a with_name function that would probably need to go away because |
If I recall correctly metadata and dictionary has not been implemented so far, though we should definitely support those. The Regarding the ArrowArray abstraction I'd need to check the implementation again (which we should clean up eventually), but I'm currently busy with the release procedure. Hopefully I can have a more thorough look at the issue after that. |
My point was that own allocations (like name) must go to private data, not sure if that was expressed clearly in my message. I'll create a draft PR to make it clearer. I can help contribute here but will probably need your guidelines for the with_name setters.
In the code and text above whenever I wrote ArrowArray I meant FFI_ArrowArray, I just used the spec name sorry for the confusion. I do agree that the ArrowArray abstraction is confusing and probably need to go away. The API should probably be similar to the bridge implementation in arrow cpp. This is more related to #596. |
On a second thought I'm not sure about this one. The rust implementation has an assumption that apart from nullifying the release callback everything is immutable. This might be a reasonable assumption even though the cpp implementation doesn't do the same and (at least to me) the spec aren't clear enough here. In contrast to the original description, the current release implementation doesn't block the possibility of (child) array move. I will verify this use case via a test case separately (e.g., to ensure that buffer lifetime is correct). |
cc @pitrou , that may help us further here. |
@jorgecarleitao Sorry for the large delay, is there something you'd like me to take a look at? |
@pitrou the question is whether it's safe to assume that other than nullifying the release callback the consumer doesn't change anything in the structures. Two examples to demonstrate the difference in implementation:
|
It is, indeed.
I'm not sure what difference it makes. In both cases it is released (directly or indirectly) by calling the release callback, no? |
The FFI implementation deviates from the C Data Interface specification in Release callback semantics – for producers.
The current implementation doesn't walk through the direct children but rather only through the children in private data. This blocks support for moving child arrays.
It also assumes that child arrays are not already released. This assumption is not true for the case of child array move. The release member must be checked to be not null before dropping/releasing an array.The current implementation doesn't seem to release the dictionary array.
Please see the reference implementation in the spec (the first line seems to be a mistake and should check for the release member):
The text was updated successfully, but these errors were encountered: