-
Notifications
You must be signed in to change notification settings - Fork 2.1k
feat : ABI upgrade from abi_stabby to stabby since abi_stable is no longer maintained #21030
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
base: main
Are you sure you want to change the base?
Changes from all commits
0c32832
65aa893
9834a59
d899199
2a84141
0319ade
9f7d00a
349b624
d0ab1fb
d6194b8
21246e2
48926f9
afa0502
ca9dbdf
d13fd4f
08b4117
ef10249
6cc66cf
af7939f
510526e
155ccea
a022a91
ddb7193
3b22836
c3e66f7
de389be
71f1fde
494dc35
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -25,5 +25,4 @@ publish = false | |
| workspace = true | ||
|
|
||
| [dependencies] | ||
| abi_stable = "0.11.3" | ||
| datafusion-ffi = { workspace = true } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -65,14 +65,39 @@ to work across Rust libraries. In general, you can use Rust's [FFI] to | |
| operate across different programming languages, but that is not the design | ||
| intent of this crate. Instead, we are using external crates that provide | ||
| stable interfaces that closely mirror the Rust native approach. To learn more | ||
| about this approach see the [abi_stable] and [async-ffi] crates. | ||
| about this approach see the [stabby] and [async-ffi] crates. | ||
|
|
||
| If you have a library in another language that you wish to interface to | ||
| DataFusion the recommendation is to create a Rust wrapper crate to interface | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For users who are interested in working on this code, they will probably ask themselves the same thing I asked. Why is it we are not using the core features of stabby? You and I have both come to the same conclusion that especially with the work on getting the record batch stream converted over to using stabby it turns into a much different project, especially when it comes to build times with the heavy macro use. I think we just need some documentation as mentioned in a prior comment. |
||
| with your library and then to connect it to DataFusion using this crate. | ||
| Alternatively, you could use [bindgen] to interface directly to the [FFI] provided | ||
| by this crate, but that is currently not supported. | ||
|
|
||
| ## Stabby Usage | ||
|
|
||
| This crate uses [stabby] for ABI-stable types like `stabby::string::String` and | ||
| `stabby::vec::Vec`. We chose stabby because [abi_stable] is no longer actively | ||
| maintained. | ||
|
|
||
| We intentionally use `#[repr(C)]` for our struct definitions instead of stabby's | ||
| `#[stabby::stabby]` macro. The reason is that stabby's `IStable` trait (required | ||
| by the macro) demands that all inner types also implement `IStable`. This creates | ||
| challenges for our use case: | ||
|
|
||
| 1. **Arrow types**: Arrow's FFI types like `FFI_ArrowSchema` do not implement | ||
| `IStable`, and adding such implementations would be laborious and error-prone. | ||
|
|
||
| 2. **Self-referential function pointers**: Many of our FFI structs contain | ||
| function pointers that reference `&Self`, which complicates `IStable` | ||
| implementations. | ||
|
|
||
| 3. **FFI_Option and FFIResult**: For similar reasons, we provide our own | ||
| `FFI_Option<T>` and `FFIResult<T>` types using `#[repr(C, u8)]` instead | ||
| of stabby's `Option` and `Result`, which require inner types to be `IStable`. | ||
|
|
||
| This hybrid approach gives us stabby's maintained, ABI-stable collection types | ||
| while retaining flexibility for our complex FFI struct layouts. | ||
|
|
||
| ## FFI Boundary | ||
|
|
||
| We expect this crate to be used by both sides of the FFI Boundary. This should | ||
|
|
@@ -197,6 +222,7 @@ and it is easy to implement on any struct that implements `Session`. | |
| [api docs]: http://docs.rs/datafusion-ffi/latest | ||
| [rust abi]: https://doc.rust-lang.org/reference/abi.html | ||
| [ffi]: https://doc.rust-lang.org/nomicon/ffi.html | ||
| [stabby]: https://crates.io/crates/stabby | ||
| [abi_stable]: https://crates.io/crates/abi_stable | ||
| [async-ffi]: https://crates.io/crates/async-ffi | ||
| [bindgen]: https://crates.io/crates/bindgen | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.