Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[R] Export functions for low-level pointer operations #39793

Open
eitsupi opened this issue Jan 25, 2024 · 1 comment
Open

[R] Export functions for low-level pointer operations #39793

eitsupi opened this issue Jan 25, 2024 · 1 comment

Comments

@eitsupi
Copy link
Contributor

eitsupi commented Jan 25, 2024

Describe the enhancement requested

It would be useful to have exported the following functions used when using the Arrow C interface.

arrow/r/R/python.R

Lines 18 to 32 in 2e8bd8d

py_to_r.pyarrow.lib.Array <- function(x, ...) {
schema_ptr <- allocate_arrow_schema()
array_ptr <- allocate_arrow_array()
on.exit({
delete_arrow_schema(schema_ptr)
delete_arrow_array(array_ptr)
})
x$`_export_to_c`(
pyarrow_compatible_pointer(array_ptr),
pyarrow_compatible_pointer(schema_ptr)
)
Array$import_from_c(array_ptr, schema_ptr)
}

  • allocate_arrow_schema
  • delete_arrow_schema
  • allocate_arrow_array
  • delete_arrow_array
  • allocate_arrow_array_stream
  • delete_arrow_array_stream

For now, these could easily be solved by having a dependency on nanoarrow, as it appears that the equivalent functions are provided by nanoarrow, but given that the functions already exist in arrow, it is not clear that it would be worthwhile for the arrow package not to export them.

Component(s)

R

@eitsupi
Copy link
Contributor Author

eitsupi commented Jan 31, 2024

Use case example pola-rs/r-polars#754

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

No branches or pull requests

1 participant