[ 
https://issues.apache.org/jira/browse/ARROW-11120?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17258221#comment-17258221
 ] 

Laurent commented on ARROW-11120:
---------------------------------

[~jorisvandenbossche] Thanks. I did confuse a few things, and came in with the 
(wrong) assumption that an R "External Pointer", traditionnaly the way to have 
pointers to external C or C++ structures, would be used.
In fact this _export_to_c` is used as you point it out (here in the R package: 
https://github.com/apache/arrow/blob/master/r/R/python.R#L26).

In the end the workflow is more like:
* load the R package "arrow" in the embedded R
* in R get pointers (`uintptr_t` cast to `double)` with 
`arrow::allocate_arrow_schema()` and `arrow::allocate_arrow_array()`
* in Python call the method `_export_to_c` using the two pointers above 
(casting back from `double` to `uintptr_t`) 
* in R call `arrow::ImportArray(array_ptr, schema_ptr)`

If correct this time, this is great news as it removes the cffi - 
C-extension/Cython issue.

> [Python][R] Prove out plumbing to pass data between Python and R using rpy2
> ---------------------------------------------------------------------------
>
>                 Key: ARROW-11120
>                 URL: https://issues.apache.org/jira/browse/ARROW-11120
>             Project: Apache Arrow
>          Issue Type: Improvement
>          Components: Python, R
>            Reporter: Wes McKinney
>            Priority: Major
>
> Per discussion on the mailing list, we should see what is required (if 
> anything) to be able to pass data structures using the C interface between 
> Python and R from the perspective of the Python user using rpy2. rpy2 is sort 
> of the Python version of reticulate. Unit tests will then validate that it's 
> working



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to