Repository: arrow Updated Branches: refs/heads/master 063c190a5 -> cfb544de2
ARROW-425: Add private API to get python Table from a C++ object Author: Uwe L. Korn <[email protected]> Closes #241 from xhochy/pyarrow-private-api and squashes the following commits: dc9b814 [Uwe L. Korn] ARROW-425: Add private API to get python Table from a C++ object Project: http://git-wip-us.apache.org/repos/asf/arrow/repo Commit: http://git-wip-us.apache.org/repos/asf/arrow/commit/cfb544de Tree: http://git-wip-us.apache.org/repos/asf/arrow/tree/cfb544de Diff: http://git-wip-us.apache.org/repos/asf/arrow/diff/cfb544de Branch: refs/heads/master Commit: cfb544de2efb260bc0737460e056a0d2a5295e6a Parents: 063c190 Author: Uwe L. Korn <[email protected]> Authored: Thu Dec 15 13:16:01 2016 -0500 Committer: Wes McKinney <[email protected]> Committed: Thu Dec 15 13:16:01 2016 -0500 ---------------------------------------------------------------------- python/pyarrow/table.pxd | 2 ++ python/pyarrow/table.pyx | 4 ++++ python/setup.py | 11 +++++++++++ 3 files changed, 17 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/arrow/blob/cfb544de/python/pyarrow/table.pxd ---------------------------------------------------------------------- diff --git a/python/pyarrow/table.pxd b/python/pyarrow/table.pxd index 79c9ae3..df3687d 100644 --- a/python/pyarrow/table.pxd +++ b/python/pyarrow/table.pxd @@ -57,3 +57,5 @@ cdef class RecordBatch: cdef init(self, const shared_ptr[CRecordBatch]& table) cdef _check_nullptr(self) + +cdef api object table_from_ctable(const shared_ptr[CTable]& ctable) http://git-wip-us.apache.org/repos/asf/arrow/blob/cfb544de/python/pyarrow/table.pyx ---------------------------------------------------------------------- diff --git a/python/pyarrow/table.pyx b/python/pyarrow/table.pyx index 0a9805c..333686f 100644 --- a/python/pyarrow/table.pyx +++ b/python/pyarrow/table.pyx @@ -687,5 +687,9 @@ cdef class Table: return (self.num_rows, self.num_columns) +cdef api object table_from_ctable(const shared_ptr[CTable]& ctable): + cdef Table table = Table() + table.init(ctable) + return table from_pandas_dataframe = Table.from_pandas http://git-wip-us.apache.org/repos/asf/arrow/blob/cfb544de/python/setup.py ---------------------------------------------------------------------- diff --git a/python/setup.py b/python/setup.py index 0f6bbda..5acdca3 100644 --- a/python/setup.py +++ b/python/setup.py @@ -204,6 +204,10 @@ class build_ext(_build_ext): shutil.move(self.get_ext_built(name), ext_path) self._found_names.append(name) + if os.path.exists(self.get_ext_built_api_header(name)): + shutil.move(self.get_ext_built_api_header(name), + pjoin(os.path.dirname(ext_path), name + '_api.h')) + os.chdir(saved_cwd) def _failure_permitted(self, name): @@ -225,6 +229,13 @@ class build_ext(_build_ext): filename = name + suffix return pjoin(package_dir, filename) + def get_ext_built_api_header(self, name): + if sys.platform == 'win32': + head, tail = os.path.split(name) + return pjoin(head, tail + "_api.h") + else: + return pjoin(name + "_api.h") + def get_ext_built(self, name): if sys.platform == 'win32': head, tail = os.path.split(name)
