timsaucer opened a new pull request, #18672: URL: https://github.com/apache/datafusion/pull/18672
## Which issue does this PR close? - Addresses part of https://github.com/apache/datafusion/issues/18671 but does not close it. Note: This is based on top of https://github.com/apache/datafusion/pull/18657. I will rebase after that one merges to remove the parts of the code that are not relevant to this PR. ## Rationale for this change This PR adds the concept of a `library_marker_id` to the FFI crate. The reason for this is described in the `README` text as part of the PR. In our current use of the FFI library we get into issues where we round trip FFI structs back to their original library that now have FFI wrappers when they are no longer needed. ## What changes are included in this PR? - Adds a method to find the memory address of a static constant in the library. - Adds a check in methods that are creating Foreign FFI structs to see if we are actually in the local library or are actually foreign. - Replaces the `From<> for Foreign` to `From<> for Arc<dyn ...>`. The actual use case is essentially always to use these structs as their implementation of the trait they back. - Adds unit tests and a method to mock being in foreign code - Removed an unused function call in `FFI_ScalarUDF` ## Are these changes tested? - Code is tested against existing unit tests and with `datafusion-python`. - Added unit tests - Coverage report compared to `main`: <img width="1146" height="788" alt="coverage-report" src="https://github.com/user-attachments/assets/f422ee20-35d6-4a10-ae96-c38b59e26acb" /> ## Are there any user-facing changes? This does change the API for the FFI functions. TODO(tsaucer): Add text to migration guide to demonstrate required changes. -- 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] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
