Skip to content

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

Open
coderfender wants to merge 13 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 13 commits intoapache:mainfrom
coderfender:feat_migrate_ffi_to_stabby

Conversation

@coderfender
Copy link
Contributor

@coderfender coderfender commented Mar 18, 2026

Which issue does this PR close?

Rationale for this change

What changes are included in this PR?

Are these changes tested?

Are there any user-facing changes?

@coderfender
Copy link
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
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
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
FFIResult, rvec_wrapped_to_vec_datatype, vec_datatype_to_rvec_wrapped,
};
use crate::volatility::FFI_Volatility;
use crate::volatility::FfiVolatility;
Copy link
Member

Choose a reason for hiding this comment

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

The naming convention I used here was to match Arrow's FFI convention.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you for the comment @timsaucer . I had to rename these structs to fix clippy errors . Do you think we should stick with clippy recommended naming convention or we could revert to use arrow's convention and ignore clippy warnings ?

Copy link
Member

Choose a reason for hiding this comment

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

We had a clippy override in the repo before. I wonder if it's getting lost in the update?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was under the impression. Let me see if I can get it fixed

Copy link
Member

Choose a reason for hiding this comment

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

#19480 is where it changed

Copy link
Member

Choose a reason for hiding this comment

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

If we can get clippy to ignore it for everything in datafusion/ffi/src I think that would be ideal. What do you think? Do you have a strong preference on naming?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think now is a good time to make it clippy complaint given that we are making a major change . However, if the goal is to keep it consistent with Arrow's notation I can go ahead and revert the naming convention

Comment on lines +23 to +24
use stabby::string::String as StabbyString;
use stabby::vec::Vec as StabbyVec;
Copy link
Member

Choose a reason for hiding this comment

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

Minor: Recommend naming SString and SVec to be a bit less distracting.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@timsaucer thank you. I had to resort to clear naming to avoid mistakes with the crate upgrade. Now that the code compiles, I will push a commit to make the naming shorter

@coderfender
Copy link
Contributor Author

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

@coderfender
Copy link
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
Contributor Author

Testing python bindings now with the new ABI

@coderfender
Copy link
Contributor Author

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

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