Skip to content

feat: make FFI structs fields pub#9772

Merged
alamb merged 1 commit into
apache:mainfrom
ashdnazg:expose-ffi2
Apr 22, 2026
Merged

feat: make FFI structs fields pub#9772
alamb merged 1 commit into
apache:mainfrom
ashdnazg:expose-ffi2

Conversation

@ashdnazg
Copy link
Copy Markdown
Contributor

Which issue does this PR close?

Are these changes tested?

No need for additional tests.

Are there any user-facing changes?

New fields are exposed.

@ashdnazg ashdnazg changed the title Expose ffi2 feat: make FFI structs fields pub. Apr 20, 2026
@github-actions github-actions Bot added the arrow Changes to the arrow crate label Apr 20, 2026
Copy link
Copy Markdown
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

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

Thanks @ashdnazg -- this mostly looks good to me

I am not sure about the new unsafe impl Sync though

Comment thread arrow-array/src/ffi_stream.rs Outdated
}

unsafe impl Send for FFI_ArrowArrayStream {}
unsafe impl Sync for FFI_ArrowArrayStream {}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why is this change made? I didn't see any mention of it in the PR description and given there are a buch of pointers involved I am not sure if it is safe to share this data across threads 🤔

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fair question, I should've mentioned this.
Notice that FFI_ArrowArray is already Sync:
https://github.com/ashdnazg/arrow-rs/blob/aaf160f76e92b838b917d5e4be62de693258405f/arrow-data/src/ffi.rs#L77

IMO since these are FFI objects, they're kind of "anything goes", because whatever language you give them to, can do whatever it wants with them, so disallowing it inside Rust seems unhelpful. In addition, what little safe API they have, seems to be thread-safe (no cells and the like).

This is not super important, I can leave it out if you prefer, but I think it does make sense.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can you please pull it into a separate PR that we can discuss and analyze by itself. Otherwise this PR is ready to go from my perspective

Comment thread arrow-schema/src/ffi.rs Outdated
}

unsafe impl Send for FFI_ArrowSchema {}
unsafe impl Sync for FFI_ArrowSchema {}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

likewise here -- why is this necessary?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

same.

These are defined in the standard, so encapsulation is unnecessary.
@ashdnazg
Copy link
Copy Markdown
Contributor Author

ashdnazg commented Apr 21, 2026

rebased and removed Sync changes

Copy link
Copy Markdown
Contributor

@alamb alamb 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 @ashdnazg

@alamb alamb changed the title feat: make FFI structs fields pub. feat: make FFI structs fields pub Apr 22, 2026
@alamb alamb merged commit b93240a into apache:main Apr 22, 2026
27 checks passed
@alamb
Copy link
Copy Markdown
Contributor

alamb commented Apr 22, 2026

🚀

Rich-T-kid pushed a commit to Rich-T-kid/arrow-rs that referenced this pull request Jun 2, 2026
# Which issue does this PR close?

- Closes apache#9771 .

# Are these changes tested?

No need for additional tests.

# Are there any user-facing changes?

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

Labels

arrow Changes to the arrow crate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Expose FFI data structures fields

2 participants