Skip to content

Conversation

@eitsupi
Copy link
Contributor

@eitsupi eitsupi commented Aug 31, 2025

Close #3106
Close #3390

Move the adbc_core::ffi module, except for adbc_core::ffi::constants and adbc_core::types::FFI_AdbcStatusCode, to the new adbc_ffi package.

And, also rename the two that were not moved:

  • Rename adbc_core::ffi::constants to adbc_core::constants
  • Rename adbc_core::types::FFI_AdbcStatusCode to adbc_core::error::AdbcStatusCode

@eitsupi eitsupi marked this pull request as ready for review August 31, 2025 14:03
@eitsupi eitsupi requested a review from wjones127 as a code owner August 31, 2025 14:03
@github-actions github-actions bot added this to the ADBC Libraries 20 milestone Aug 31, 2025
@eitsupi
Copy link
Contributor Author

eitsupi commented Aug 31, 2025

CC @mbrobbel @felipecrv

Copy link
Member

@mbrobbel mbrobbel left a comment

Choose a reason for hiding this comment

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

Looks good! Just some minor question/suggestions from me.

We should also add this crate to

cargo publish --all-features -p adbc_core
cargo publish --all-features -p adbc_datafusion
cargo publish --all-features -p adbc_snowflake
.


use crate::constants;

pub type AdbcStatusCode = u8;
Copy link
Member

Choose a reason for hiding this comment

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

I guess we can't move this to the FFI crate because the TryFrom implementation has to be in this crate?

Copy link
Member

Choose a reason for hiding this comment

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

We could move it and provide a TryInto impl?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

As you guessed, I got stuck after my first attempt to move FFI_AdbcStatusCode to adbc_ffi and had to restart by moving it to another module, just like the first commit in this PR (7ff5fb5).

I believe it's better to keep this in adbc_core for the following reasons:

  1. To implement TryFrom / From.
  2. It's referenced from the constants mod.
  3. This status code doesn't include FFI.

Copy link
Contributor

Choose a reason for hiding this comment

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

Just return u8 on the FFI side. We only need u8 to AdbcStatus Into. Let's not have 2 layers of conversions for an enum.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

As I wrote in the comments below, I'm wondering if this should be placed in the constants mod since it's defined in adbc.h.
#3381 (comment)

Copy link
Contributor

Choose a reason for hiding this comment

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

Fine by me. I just don't want another layer of conversion/indirection.

@lidavidm lidavidm requested a review from paleolimbot August 31, 2025 23:37
Copy link
Member

@paleolimbot paleolimbot left a comment

Choose a reason for hiding this comment

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

I don't have much to add here...I think separating these is great!

Copy link
Contributor Author

@eitsupi eitsupi left a comment

Choose a reason for hiding this comment

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

Thank you everyone for your quick comments. I'll update later.


use crate::constants;

pub type AdbcStatusCode = u8;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

As you guessed, I got stuck after my first attempt to move FFI_AdbcStatusCode to adbc_ffi and had to restart by moving it to another module, just like the first commit in this PR (7ff5fb5).

I believe it's better to keep this in adbc_core for the following reasons:

  1. To implement TryFrom / From.
  2. It's referenced from the constants mod.
  3. This status code doesn't include FFI.

@eitsupi eitsupi requested a review from kou as a code owner September 1, 2025 15:35
Copy link
Contributor

@felipecrv felipecrv left a comment

Choose a reason for hiding this comment

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

I'm in favor of merging this PR as it is. It's in a good state and the pending suggestions seem unrelated to the task of extracting the FFI module.

Copy link
Member

@lidavidm lidavidm left a comment

Choose a reason for hiding this comment

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

I think this is reasonable as-is. I'll merge later today unless there's objections

@lidavidm lidavidm merged commit dc530d9 into apache:main Sep 3, 2025
11 checks passed
@eitsupi eitsupi deleted the rust-ffi branch September 3, 2025 10:23
lidavidm pushed a commit that referenced this pull request Oct 1, 2025
The driver exporter has been moved from `adbc_core` to `adbc_ffi` in
#3381; however, the README
remains unchanged. I found this discrepancy when upgrading the
`adbc_core` dependency of
[SedonaDB](https://github.com/apache/sedona-db). This out-dated
information also appears in https://crates.io/crates/adbc_core and made
me frustrated, so I decided to submit a PR containing this very tiny
fix.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

dev: post-08-rust.sh needs to be updated with new crates Rust: Split adbc_core into several crates

5 participants