Skip to content

Commit af7904f

Browse files
authored
feat : ABI upgrade from abi_stabby to stabby since abi_stable is no longer maintained (#21030)
## Which issue does this PR close? <!-- We generally require a GitHub issue to be filed for all bug fixes and enhancements and this helps us generate change logs for our releases. You can link an issue to this PR using the GitHub syntax. For example `Closes #123` indicates that this PR will close issue #123. --> - Closes #20863 ## Rationale for this change <!-- Why are you proposing this change? If this is already explained clearly in the issue then this section is not needed. Explaining clearly why changes are proposed helps reviewers understand your changes and offer better suggestions for fixes. --> ## What changes are included in this PR? - Replace abi_stable types with stabby equivalents: - `RVec` -> `stabby::vec::Vec` - `RString` -> `stabby::string::String` - Add custom `FFI_Option` and `FFI_Result` types since we have raw pointers and self referential pointers which can't implement `IStable` trait needed for stabby - Rename `macros: rresult` → `sresult`, `rresult_return `→ `sresult_return` - Fix library path detection for debug/release builds in the example loader - Update README <!-- There is no need to duplicate the description in the issue here but it is sometimes worth providing a summary of the individual changes in this PR. --> ## Are these changes tested? Yes . With df python bindings on DF 52 release <!-- We typically require tests for all PRs in order to: 1. Prevent the code from being accidentally broken by subsequent changes 2. Serve as another way to document the expected behavior of the code If tests are not included in your PR, please explain why (for example, are they covered by existing tests)? --> ## Are there any user-facing changes? <!-- If there are user-facing changes then we may require documentation to be updated before approving the PR. --> <!-- If there are any breaking changes to public APIs, please add the `api change` label. -->
1 parent 95ef332 commit af7904f

62 files changed

Lines changed: 1264 additions & 1278 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Cargo.lock

Lines changed: 47 additions & 148 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

datafusion-examples/examples/ffi/ffi_example_table_provider/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ edition = { workspace = true }
2222
publish = false
2323

2424
[dependencies]
25-
abi_stable = "0.11.3"
2625
arrow = { workspace = true }
2726
datafusion = { workspace = true }
2827
datafusion-ffi = { workspace = true }

datafusion-examples/examples/ffi/ffi_example_table_provider/src/lib.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,12 @@
1717

1818
use std::sync::Arc;
1919

20-
use abi_stable::{export_root_module, prefix_type::PrefixTypeTrait};
2120
use arrow::array::RecordBatch;
2221
use arrow::datatypes::{DataType, Field, Schema};
2322
use datafusion::{common::record_batch, datasource::MemTable};
2423
use datafusion_ffi::proto::logical_extension_codec::FFI_LogicalExtensionCodec;
2524
use datafusion_ffi::table_provider::FFI_TableProvider;
26-
use ffi_module_interface::{TableProviderModule, TableProviderModuleRef};
25+
use ffi_module_interface::TableProviderModule;
2726

2827
fn create_record_batch(start_value: i32, num_values: usize) -> RecordBatch {
2928
let end_value = start_value + num_values as i32;
@@ -56,11 +55,10 @@ extern "C" fn construct_simple_table_provider(
5655
FFI_TableProvider::new_with_ffi_codec(Arc::new(table_provider), true, None, codec)
5756
}
5857

59-
#[export_root_module]
58+
#[unsafe(no_mangle)]
6059
/// This defines the entry point for using the module.
61-
pub fn get_simple_memory_table() -> TableProviderModuleRef {
60+
pub extern "C" fn ffi_example_get_module() -> TableProviderModule {
6261
TableProviderModule {
6362
create_table: construct_simple_table_provider,
6463
}
65-
.leak_into_prefix()
6664
}

datafusion-examples/examples/ffi/ffi_module_interface/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,4 @@ publish = false
2525
workspace = true
2626

2727
[dependencies]
28-
abi_stable = "0.11.3"
2928
datafusion-ffi = { workspace = true }

0 commit comments

Comments
 (0)