bit2swaz commented on issue #10679:
URL: https://github.com/apache/arrow-rs/issues/10679#issuecomment-5340988205
yep, thats basically it. we never touch the incoming `private_data`, we just
box a wrapper around it:
```rust
struct WithMetadata {
metadata: Vec<u8>, // our new serialized metadata, kept alive
inner_release: Option<unsafe extern "C" fn(*mut FFI_ArrowSchema)>,
inner_private_data: *mut c_void, // pyarrow's, untouched
}
```
then point `self.metadata` at the new bytes, set `self.private_data` to the
boxed wrapper, and install our own `release`. on drop, our `release` frees the
wrapper (our metadata) then calls `inner_release` on a temp schema carrying
`inner_private_data`, so pyarrow still cleans up its own state
works the same for an arrow-rs schema: the inner release is just
`release_schema` and it chains fine. `set_release`/`set_private_data` already
exist for exactly this. it also fixes #10286, since a null inner is just a
no-op chain
--
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]