Skip to content

feat : ABI upgrade from abi_stabby to stabby since abi_stable is no longer maintained#21030

Open
coderfender wants to merge 21 commits intoapache:mainfrom
coderfender:feat_migrate_ffi_to_stabby
Open

feat : ABI upgrade from abi_stabby to stabby since abi_stable is no longer maintained#21030
coderfender wants to merge 21 commits intoapache:mainfrom
coderfender:feat_migrate_ffi_to_stabby

Conversation

@coderfender
Copy link
Copy Markdown
Contributor

@coderfender coderfender commented Mar 18, 2026

Which issue does this PR close?

Rationale for this change

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: rresultsresult, rresult_return sresult_return
  • Fix library path detection for debug/release builds in the example loader
  • Update README

Are these changes tested?

Yes . With df python bindings on DF 52 release

Are there any user-facing changes?

@coderfender
Copy link
Copy Markdown
Contributor Author

coderfender commented Mar 18, 2026

Linking Tim's PR here #21025

@coderfender coderfender changed the title feat : ABI change from abi_stabby to stabby feat : ABI upgrade from abi_stabby to stabby since abi_stable is no longer maintained Mar 18, 2026
@github-actions github-actions bot added the ffi Changes to the ffi crate label Mar 19, 2026
@coderfender
Copy link
Copy Markdown
Contributor Author

  1. Removed abi_stable package dependency

  2. Replaced all abi_stable calls with stabby equivalents

  3. Used Vec<K,V> since stabby doesnt have HashMap support
    TODO :

  4. Work on WrappedArray / native arrow types integration (Original impl through ABI just assumed safe implementation through sabi. However, stabby's answer is a little different)

  5. Refactor / remove async-ffi module ( IMHO, this can be done in a separate followup PR)

@timsaucer
Copy link
Copy Markdown
Member

One of the things I've been thinking about here is doing some scale testing of performance, which I haven't done on the FFI crate really. I was thinking we could do something along the lines of using https://github.com/datafusion-contrib/datafusion-tpch to generate table providers at different scale factors. Then it would seem we could have a series of tests:

  1. Pure rust with no FFI work.
  2. Pure rust but using two modules and passing table provider via FFI.
  3. Expose table provider to python and test with datafusion-python.

The thing I like about doing this is that we would be able to see the impacts of each of the layers between the code, ideally going from 2->3 having near zero impact.

For such a test I would think about setting up a stream, reading in and dumping the data as fast as possible.

Since this is orthogonal to the actual FFI work you're proposing I might try setting this up on a test repo.

@coderfender coderfender force-pushed the feat_migrate_ffi_to_stabby branch from 7dea35a to 9834a59 Compare March 20, 2026 12:57
@coderfender
Copy link
Copy Markdown
Contributor Author

Merged with main and see some referenced older package. Working on fixing it to use stabby

@coderfender
Copy link
Copy Markdown
Contributor Author

Updated cargo format , changed table_provider_module to use the direct function pointer call instead of accessor method pattern used in abi_stable

@coderfender coderfender force-pushed the feat_migrate_ffi_to_stabby branch from 70a5478 to d6194b8 Compare March 20, 2026 23:11
@coderfender coderfender marked this pull request as ready for review March 20, 2026 23:21
@coderfender
Copy link
Copy Markdown
Contributor Author

Testing python bindings now with the new ABI

@coderfender
Copy link
Copy Markdown
Contributor Author

The df python bindings rendered through new stabby implementations seem to be working on my local machine

Copy link
Copy Markdown
Member

@timsaucer timsaucer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really nice work on this. I've put in a few questions. I think it's really great that the vast majority of the changes are pretty simple and have 1-1 replacement.

@coderfender
Copy link
Copy Markdown
Contributor Author

thank you for the comments @timsaucer . I will work on the comments and push a commit shortly

@coderfender coderfender force-pushed the feat_migrate_ffi_to_stabby branch from d63326d to 48926f9 Compare March 25, 2026 04:39
@coderfender
Copy link
Copy Markdown
Contributor Author

Pushed a commit to address review comments . Please take a look whenever you get a chance

@coderfender
Copy link
Copy Markdown
Contributor Author

I'll rebase this branch blue that we have FFI for Physical optimizer rule change merged to main

@coderfender coderfender force-pushed the feat_migrate_ffi_to_stabby branch from 7f4ba21 to eb18d0c Compare March 27, 2026 00:13
@coderfender coderfender force-pushed the feat_migrate_ffi_to_stabby branch from eb18d0c to 08b4117 Compare March 27, 2026 03:04
@coderfender
Copy link
Copy Markdown
Contributor Author

@timsaucer , I updated PhysicalOptimizerRule to use stabby instead of abi_stable as well. Please take a look whenever you get a chance . Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ffi Changes to the ffi crate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remove generational-arena from project

2 participants