Skip to content

GH-39793: [R] Export the C Data Interface allocators and document $export_to_c() / $import_from_c() - #51236

Open
singhpratech wants to merge 2 commits into
apache:mainfrom
singhpratech:GH-39793-r-export-c-data-interface
Open

GH-39793: [R] Export the C Data Interface allocators and document $export_to_c() / $import_from_c()#51236
singhpratech wants to merge 2 commits into
apache:mainfrom
singhpratech:GH-39793-r-export-c-data-interface

Conversation

@singhpratech

@singhpratech singhpratech commented Sep 8, 2026

Copy link
Copy Markdown

Rationale for this change

Follows up on #39793. Array$export_to_c() and Array$import_from_c() work, but the functions that
produce the pointers they take, allocate_arrow_schema() and friends, are not exported, and none of
it has a help page, so a package that hands a column to another library over the C Data Interface
has to use arrow:::, which R CMD check flags.

What changes are included in this PR?

The six allocate/delete functions from the issue are exported and documented on one help page
(?c-data-interface) with a round-trip example; the Array methods list names $export_to_c()
and $import_from_c(); a NEWS entry; two tests in test-bridge.R. NAMESPACE and the man pages were
regenerated with roxygen2 8.0.0, the version in Config/roxygen2/version, so the diff is only the
additions. Per @thisisnic's note on #51227, the alignment behaviour of Array$create() is a code
comment in the new file, not user documentation.

Are these changes tested?

Yes: test-bridge.R gains a test that the six names are exported and a test that an Array with
a null round-trips through the exported functions. The example on the help page runs under
R CMD check as well.

Are there any user-facing changes?

Yes: six newly exported functions and one new help page. No existing behaviour changes.

Thank you for looking at this. Happy to adjust the wording of the help page or move the
functions' documentation wherever fits the package's conventions better.

Closes #39793.

…nt $export_to_c() / $import_from_c()

allocate_arrow_schema(), delete_arrow_schema(), allocate_arrow_array(), delete_arrow_array(),
allocate_arrow_array_stream() and delete_arrow_array_stream() are now exported, with a help page
(?c-data-interface) that shows the round trip, and the Array methods list names
$export_to_c() and $import_from_c(). Two tests cover the exports and an Array round trip through
the exported functions. Closes apache#39793.
singhpratech added a commit to singhpratech/ArrowMetal that referenced this pull request Sep 8, 2026
…Data Interface exports

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WQYE6hSNYZur5fRZC3mqGT
@github-actions

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown

⚠️ GitHub issue #39793 has been automatically assigned in GitHub to PR creator.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[R] Export functions for low-level pointer operations

1 participant