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

Kouhei Sutou commented on ARROW-16340:
--------------------------------------

Yes, {{pyarrow.ipc.RecordBatchReader._import_from_c}} is a Python code.

Thanks for sharing the pybind11's API document. It seems that we can write the 
code like the following:

{code:cpp}
{
  py::scoped_interpreter guard{};
  py::module_ pyarrow = py::module_::import("pyarrow"); // We can use auto
  py::object py_reader_import_from_c = 
pyarrow.attr("ipc").attr("RecordBatchReader").attr("_import_from_c")
  // uintptr_t isn't listed here: 
https://pybind11.readthedocs.io/en/stable/advanced/cast/overview.html#list-of-all-builtin-conversions
  py::object py_reader = 
py_reader_import_from_c(static_cast<uint64_t>(static_cast<uintptr_t>(&c_stream)));
  py::object py_table = pyarrow.attr("Table").attr("from_batches")(py_reader);
  return pybind11::reinterpret_steal<pybind11::object>(py_table);
}
{code}

> [C++][Python] Move all Python related code into PyArrow
> -------------------------------------------------------
>
>                 Key: ARROW-16340
>                 URL: https://issues.apache.org/jira/browse/ARROW-16340
>             Project: Apache Arrow
>          Issue Type: Improvement
>          Components: C++, Python
>            Reporter: Alenka Frim
>            Assignee: Alenka Frim
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: 10.0.0
>
>          Time Spent: 33h 10m
>  Remaining Estimate: 0h
>
> Move {{src/arrow/python}} directory into {{pyarrow}} and arrange PyArrow to 
> build it.
> More details can be found on this thread:
> https://lists.apache.org/thread/jbxyldhqff4p9z53whhs95y4jcomdgd2



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to