Repository: arrow Updated Branches: refs/heads/master 6d4e86290 -> 3aac4adef
http://git-wip-us.apache.org/repos/asf/arrow/blob/3aac4ade/python/src/pyarrow/io.cc ---------------------------------------------------------------------- diff --git a/python/src/pyarrow/io.cc b/python/src/pyarrow/io.cc deleted file mode 100644 index c66155b..0000000 --- a/python/src/pyarrow/io.cc +++ /dev/null @@ -1,221 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -#include "pyarrow/io.h" - -#include <cstdint> -#include <cstdlib> - -#include "arrow/io/memory.h" -#include "arrow/memory_pool.h" -#include "arrow/status.h" - -#include "pyarrow/common.h" - -namespace arrow { -namespace py { - -// ---------------------------------------------------------------------- -// Python file - -PythonFile::PythonFile(PyObject* file) : file_(file) { - Py_INCREF(file_); -} - -PythonFile::~PythonFile() { - Py_DECREF(file_); -} - -static Status CheckPyError() { - if (PyErr_Occurred()) { - PyObject *exc_type, *exc_value, *traceback; - PyErr_Fetch(&exc_type, &exc_value, &traceback); - PyObjectStringify stringified(exc_value); - std::string message(stringified.bytes); - Py_XDECREF(exc_type); - Py_XDECREF(exc_value); - Py_XDECREF(traceback); - PyErr_Clear(); - return Status::IOError(message); - } - return Status::OK(); -} - -// This is annoying: because C++11 does not allow implicit conversion of string -// literals to non-const char*, we need to go through some gymnastics to use -// PyObject_CallMethod without a lot of pain (its arguments are non-const -// char*) -template <typename... ArgTypes> -static inline PyObject* cpp_PyObject_CallMethod( - PyObject* obj, const char* method_name, const char* argspec, ArgTypes... args) { - return PyObject_CallMethod( - obj, const_cast<char*>(method_name), const_cast<char*>(argspec), args...); -} - -Status PythonFile::Close() { - // whence: 0 for relative to start of file, 2 for end of file - PyObject* result = cpp_PyObject_CallMethod(file_, "close", "()"); - Py_XDECREF(result); - ARROW_RETURN_NOT_OK(CheckPyError()); - return Status::OK(); -} - -Status PythonFile::Seek(int64_t position, int whence) { - // whence: 0 for relative to start of file, 2 for end of file - PyObject* result = cpp_PyObject_CallMethod(file_, "seek", "(ii)", position, whence); - Py_XDECREF(result); - ARROW_RETURN_NOT_OK(CheckPyError()); - return Status::OK(); -} - -Status PythonFile::Read(int64_t nbytes, PyObject** out) { - PyObject* result = cpp_PyObject_CallMethod(file_, "read", "(i)", nbytes); - ARROW_RETURN_NOT_OK(CheckPyError()); - *out = result; - return Status::OK(); -} - -Status PythonFile::Write(const uint8_t* data, int64_t nbytes) { - PyObject* py_data = - PyBytes_FromStringAndSize(reinterpret_cast<const char*>(data), nbytes); - ARROW_RETURN_NOT_OK(CheckPyError()); - - PyObject* result = cpp_PyObject_CallMethod(file_, "write", "(O)", py_data); - Py_XDECREF(py_data); - Py_XDECREF(result); - ARROW_RETURN_NOT_OK(CheckPyError()); - return Status::OK(); -} - -Status PythonFile::Tell(int64_t* position) { - PyObject* result = cpp_PyObject_CallMethod(file_, "tell", "()"); - ARROW_RETURN_NOT_OK(CheckPyError()); - - *position = PyLong_AsLongLong(result); - Py_DECREF(result); - - // PyLong_AsLongLong can raise OverflowError - ARROW_RETURN_NOT_OK(CheckPyError()); - - return Status::OK(); -} - -// ---------------------------------------------------------------------- -// Seekable input stream - -PyReadableFile::PyReadableFile(PyObject* file) { - file_.reset(new PythonFile(file)); -} - -PyReadableFile::~PyReadableFile() {} - -Status PyReadableFile::Close() { - PyAcquireGIL lock; - return file_->Close(); -} - -Status PyReadableFile::Seek(int64_t position) { - PyAcquireGIL lock; - return file_->Seek(position, 0); -} - -Status PyReadableFile::Tell(int64_t* position) { - PyAcquireGIL lock; - return file_->Tell(position); -} - -Status PyReadableFile::Read(int64_t nbytes, int64_t* bytes_read, uint8_t* out) { - PyAcquireGIL lock; - PyObject* bytes_obj; - ARROW_RETURN_NOT_OK(file_->Read(nbytes, &bytes_obj)); - - *bytes_read = PyBytes_GET_SIZE(bytes_obj); - std::memcpy(out, PyBytes_AS_STRING(bytes_obj), *bytes_read); - Py_DECREF(bytes_obj); - - return Status::OK(); -} - -Status PyReadableFile::Read(int64_t nbytes, std::shared_ptr<Buffer>* out) { - PyAcquireGIL lock; - - PyObject* bytes_obj; - ARROW_RETURN_NOT_OK(file_->Read(nbytes, &bytes_obj)); - - *out = std::make_shared<PyBuffer>(bytes_obj); - Py_DECREF(bytes_obj); - - return Status::OK(); -} - -Status PyReadableFile::GetSize(int64_t* size) { - PyAcquireGIL lock; - - int64_t current_position; - ; - ARROW_RETURN_NOT_OK(file_->Tell(¤t_position)); - - ARROW_RETURN_NOT_OK(file_->Seek(0, 2)); - - int64_t file_size; - ARROW_RETURN_NOT_OK(file_->Tell(&file_size)); - - // Restore previous file position - ARROW_RETURN_NOT_OK(file_->Seek(current_position, 0)); - - *size = file_size; - return Status::OK(); -} - -bool PyReadableFile::supports_zero_copy() const { - return false; -} - -// ---------------------------------------------------------------------- -// Output stream - -PyOutputStream::PyOutputStream(PyObject* file) { - file_.reset(new PythonFile(file)); -} - -PyOutputStream::~PyOutputStream() {} - -Status PyOutputStream::Close() { - PyAcquireGIL lock; - return file_->Close(); -} - -Status PyOutputStream::Tell(int64_t* position) { - PyAcquireGIL lock; - return file_->Tell(position); -} - -Status PyOutputStream::Write(const uint8_t* data, int64_t nbytes) { - PyAcquireGIL lock; - return file_->Write(data, nbytes); -} - -// ---------------------------------------------------------------------- -// A readable file that is backed by a PyBuffer - -PyBytesReader::PyBytesReader(PyObject* obj) - : io::BufferReader(std::make_shared<PyBuffer>(obj)) {} - -PyBytesReader::~PyBytesReader() {} - -} // namespace py -} // namespace arrow http://git-wip-us.apache.org/repos/asf/arrow/blob/3aac4ade/python/src/pyarrow/io.h ---------------------------------------------------------------------- diff --git a/python/src/pyarrow/io.h b/python/src/pyarrow/io.h deleted file mode 100644 index 89af609..0000000 --- a/python/src/pyarrow/io.h +++ /dev/null @@ -1,99 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -#ifndef PYARROW_IO_H -#define PYARROW_IO_H - -#include "arrow/io/interfaces.h" -#include "arrow/io/memory.h" -#include "arrow/util/visibility.h" - -#include "pyarrow/config.h" - -#include "pyarrow/common.h" - -namespace arrow { - -class MemoryPool; - -namespace py { - -// A common interface to a Python file-like object. Must acquire GIL before -// calling any methods -class PythonFile { - public: - PythonFile(PyObject* file); - ~PythonFile(); - - Status Close(); - Status Seek(int64_t position, int whence); - Status Read(int64_t nbytes, PyObject** out); - Status Tell(int64_t* position); - Status Write(const uint8_t* data, int64_t nbytes); - - private: - PyObject* file_; -}; - -class ARROW_EXPORT PyReadableFile : public io::RandomAccessFile { - public: - explicit PyReadableFile(PyObject* file); - virtual ~PyReadableFile(); - - Status Close() override; - - Status Read(int64_t nbytes, int64_t* bytes_read, uint8_t* out) override; - Status Read(int64_t nbytes, std::shared_ptr<Buffer>* out) override; - - Status GetSize(int64_t* size) override; - - Status Seek(int64_t position) override; - - Status Tell(int64_t* position) override; - - bool supports_zero_copy() const override; - - private: - std::unique_ptr<PythonFile> file_; -}; - -class ARROW_EXPORT PyOutputStream : public io::OutputStream { - public: - explicit PyOutputStream(PyObject* file); - virtual ~PyOutputStream(); - - Status Close() override; - Status Tell(int64_t* position) override; - Status Write(const uint8_t* data, int64_t nbytes) override; - - private: - std::unique_ptr<PythonFile> file_; -}; - -// A zero-copy reader backed by a PyBuffer object -class ARROW_EXPORT PyBytesReader : public io::BufferReader { - public: - explicit PyBytesReader(PyObject* obj); - virtual ~PyBytesReader(); -}; - -// TODO(wesm): seekable output files - -} // namespace py -} // namespace arrow - -#endif // PYARROW_IO_H http://git-wip-us.apache.org/repos/asf/arrow/blob/3aac4ade/python/src/pyarrow/numpy_interop.h ---------------------------------------------------------------------- diff --git a/python/src/pyarrow/numpy_interop.h b/python/src/pyarrow/numpy_interop.h deleted file mode 100644 index 57f3328..0000000 --- a/python/src/pyarrow/numpy_interop.h +++ /dev/null @@ -1,60 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -#ifndef PYARROW_NUMPY_INTEROP_H -#define PYARROW_NUMPY_INTEROP_H - -#include <Python.h> - -#include <numpy/numpyconfig.h> - -// Don't use the deprecated Numpy functions -#ifdef NPY_1_7_API_VERSION -#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION -#else -#define NPY_ARRAY_NOTSWAPPED NPY_NOTSWAPPED -#define NPY_ARRAY_ALIGNED NPY_ALIGNED -#define NPY_ARRAY_WRITEABLE NPY_WRITEABLE -#define NPY_ARRAY_UPDATEIFCOPY NPY_UPDATEIFCOPY -#endif - -// This is required to be able to access the NumPy C API properly in C++ files -// other than this main one -#define PY_ARRAY_UNIQUE_SYMBOL pyarrow_ARRAY_API -#ifndef NUMPY_IMPORT_ARRAY -#define NO_IMPORT_ARRAY -#endif - -#include <numpy/arrayobject.h> -#include <numpy/ufuncobject.h> - -namespace arrow { -namespace py { - -inline int import_numpy() { -#ifdef NUMPY_IMPORT_ARRAY - import_array1(-1); - import_umath1(-1); -#endif - - return 0; -} - -} // namespace py -} // namespace arrow - -#endif // PYARROW_NUMPY_INTEROP_H http://git-wip-us.apache.org/repos/asf/arrow/blob/3aac4ade/python/src/pyarrow/type_traits.h ---------------------------------------------------------------------- diff --git a/python/src/pyarrow/type_traits.h b/python/src/pyarrow/type_traits.h deleted file mode 100644 index cc65d5c..0000000 --- a/python/src/pyarrow/type_traits.h +++ /dev/null @@ -1,212 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -#include <Python.h> - -#include <cstdint> - -#include "pyarrow/numpy_interop.h" - -#include "arrow/builder.h" -#include "arrow/type.h" - -namespace arrow { -namespace py { - -template <int TYPE> -struct npy_traits {}; - -template <> -struct npy_traits<NPY_BOOL> { - typedef uint8_t value_type; - using TypeClass = BooleanType; - using BuilderClass = BooleanBuilder; - - static constexpr bool supports_nulls = false; - static inline bool isnull(uint8_t v) { return false; } -}; - -#define NPY_INT_DECL(TYPE, CapType, T) \ - template <> \ - struct npy_traits<NPY_##TYPE> { \ - typedef T value_type; \ - using TypeClass = CapType##Type; \ - using BuilderClass = CapType##Builder; \ - \ - static constexpr bool supports_nulls = false; \ - static inline bool isnull(T v) { return false; } \ - }; - -NPY_INT_DECL(INT8, Int8, int8_t); -NPY_INT_DECL(INT16, Int16, int16_t); -NPY_INT_DECL(INT32, Int32, int32_t); -NPY_INT_DECL(INT64, Int64, int64_t); - -NPY_INT_DECL(UINT8, UInt8, uint8_t); -NPY_INT_DECL(UINT16, UInt16, uint16_t); -NPY_INT_DECL(UINT32, UInt32, uint32_t); -NPY_INT_DECL(UINT64, UInt64, uint64_t); - -#if NPY_INT64 != NPY_LONGLONG -NPY_INT_DECL(LONGLONG, Int64, int64_t); -NPY_INT_DECL(ULONGLONG, UInt64, uint64_t); -#endif - -template <> -struct npy_traits<NPY_FLOAT32> { - typedef float value_type; - using TypeClass = FloatType; - using BuilderClass = FloatBuilder; - - static constexpr bool supports_nulls = true; - - static inline bool isnull(float v) { return v != v; } -}; - -template <> -struct npy_traits<NPY_FLOAT64> { - typedef double value_type; - using TypeClass = DoubleType; - using BuilderClass = DoubleBuilder; - - static constexpr bool supports_nulls = true; - - static inline bool isnull(double v) { return v != v; } -}; - -template <> -struct npy_traits<NPY_DATETIME> { - typedef int64_t value_type; - using TypeClass = TimestampType; - using BuilderClass = TimestampBuilder; - - static constexpr bool supports_nulls = true; - - static inline bool isnull(int64_t v) { - // NaT = -2**63 - // = -0x8000000000000000 - // = -9223372036854775808; - // = std::numeric_limits<int64_t>::min() - return v == std::numeric_limits<int64_t>::min(); - } -}; - -template <> -struct npy_traits<NPY_OBJECT> { - typedef PyObject* value_type; - static constexpr bool supports_nulls = true; -}; - -template <int TYPE> -struct arrow_traits {}; - -template <> -struct arrow_traits<Type::BOOL> { - static constexpr int npy_type = NPY_BOOL; - static constexpr bool supports_nulls = false; - static constexpr bool is_boolean = true; - static constexpr bool is_numeric_not_nullable = false; - static constexpr bool is_numeric_nullable = false; -}; - -#define INT_DECL(TYPE) \ - template <> \ - struct arrow_traits<Type::TYPE> { \ - static constexpr int npy_type = NPY_##TYPE; \ - static constexpr bool supports_nulls = false; \ - static constexpr double na_value = NAN; \ - static constexpr bool is_boolean = false; \ - static constexpr bool is_numeric_not_nullable = true; \ - static constexpr bool is_numeric_nullable = false; \ - typedef typename npy_traits<NPY_##TYPE>::value_type T; \ - }; - -INT_DECL(INT8); -INT_DECL(INT16); -INT_DECL(INT32); -INT_DECL(INT64); -INT_DECL(UINT8); -INT_DECL(UINT16); -INT_DECL(UINT32); -INT_DECL(UINT64); - -template <> -struct arrow_traits<Type::FLOAT> { - static constexpr int npy_type = NPY_FLOAT32; - static constexpr bool supports_nulls = true; - static constexpr float na_value = NAN; - static constexpr bool is_boolean = false; - static constexpr bool is_numeric_not_nullable = false; - static constexpr bool is_numeric_nullable = true; - typedef typename npy_traits<NPY_FLOAT32>::value_type T; -}; - -template <> -struct arrow_traits<Type::DOUBLE> { - static constexpr int npy_type = NPY_FLOAT64; - static constexpr bool supports_nulls = true; - static constexpr double na_value = NAN; - static constexpr bool is_boolean = false; - static constexpr bool is_numeric_not_nullable = false; - static constexpr bool is_numeric_nullable = true; - typedef typename npy_traits<NPY_FLOAT64>::value_type T; -}; - -static constexpr int64_t kPandasTimestampNull = std::numeric_limits<int64_t>::min(); - -template <> -struct arrow_traits<Type::TIMESTAMP> { - static constexpr int npy_type = NPY_DATETIME; - static constexpr bool supports_nulls = true; - static constexpr int64_t na_value = kPandasTimestampNull; - static constexpr bool is_boolean = false; - static constexpr bool is_numeric_not_nullable = false; - static constexpr bool is_numeric_nullable = true; - typedef typename npy_traits<NPY_DATETIME>::value_type T; -}; - -template <> -struct arrow_traits<Type::DATE64> { - static constexpr int npy_type = NPY_DATETIME; - static constexpr bool supports_nulls = true; - static constexpr int64_t na_value = kPandasTimestampNull; - static constexpr bool is_boolean = false; - static constexpr bool is_numeric_not_nullable = false; - static constexpr bool is_numeric_nullable = true; - typedef typename npy_traits<NPY_DATETIME>::value_type T; -}; - -template <> -struct arrow_traits<Type::STRING> { - static constexpr int npy_type = NPY_OBJECT; - static constexpr bool supports_nulls = true; - static constexpr bool is_boolean = false; - static constexpr bool is_numeric_not_nullable = false; - static constexpr bool is_numeric_nullable = false; -}; - -template <> -struct arrow_traits<Type::BINARY> { - static constexpr int npy_type = NPY_OBJECT; - static constexpr bool supports_nulls = true; - static constexpr bool is_boolean = false; - static constexpr bool is_numeric_not_nullable = false; - static constexpr bool is_numeric_nullable = false; -}; - -} // namespace py -} // namespace arrow http://git-wip-us.apache.org/repos/asf/arrow/blob/3aac4ade/python/src/pyarrow/util/CMakeLists.txt ---------------------------------------------------------------------- diff --git a/python/src/pyarrow/util/CMakeLists.txt b/python/src/pyarrow/util/CMakeLists.txt deleted file mode 100644 index 6cd49cb..0000000 --- a/python/src/pyarrow/util/CMakeLists.txt +++ /dev/null @@ -1,39 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -####################################### -# pyarrow_test_main -####################################### - -if (PYARROW_BUILD_TESTS) - add_library(pyarrow_test_main STATIC - test_main.cc) - - if (APPLE) - target_link_libraries(pyarrow_test_main - gtest - dl) - set_target_properties(pyarrow_test_main - PROPERTIES LINK_FLAGS "-undefined dynamic_lookup") - else() - target_link_libraries(pyarrow_test_main - gtest - pthread - dl - ) - endif() -endif() http://git-wip-us.apache.org/repos/asf/arrow/blob/3aac4ade/python/src/pyarrow/util/datetime.h ---------------------------------------------------------------------- diff --git a/python/src/pyarrow/util/datetime.h b/python/src/pyarrow/util/datetime.h deleted file mode 100644 index f704a96..0000000 --- a/python/src/pyarrow/util/datetime.h +++ /dev/null @@ -1,42 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -#ifndef PYARROW_UTIL_DATETIME_H -#define PYARROW_UTIL_DATETIME_H - -#include <Python.h> -#include <datetime.h> - -namespace arrow { -namespace py { - -inline int64_t PyDate_to_ms(PyDateTime_Date* pydate) { - struct tm date = {0}; - date.tm_year = PyDateTime_GET_YEAR(pydate) - 1900; - date.tm_mon = PyDateTime_GET_MONTH(pydate) - 1; - date.tm_mday = PyDateTime_GET_DAY(pydate); - struct tm epoch = {0}; - epoch.tm_year = 70; - epoch.tm_mday = 1; - // Milliseconds since the epoch - return lrint(difftime(mktime(&date), mktime(&epoch)) * 1000); -} - -} // namespace py -} // namespace arrow - -#endif // PYARROW_UTIL_DATETIME_H http://git-wip-us.apache.org/repos/asf/arrow/blob/3aac4ade/python/src/pyarrow/util/test_main.cc ---------------------------------------------------------------------- diff --git a/python/src/pyarrow/util/test_main.cc b/python/src/pyarrow/util/test_main.cc deleted file mode 100644 index d8d1d03..0000000 --- a/python/src/pyarrow/util/test_main.cc +++ /dev/null @@ -1,36 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -#include <Python.h> - -#include <gtest/gtest.h> - -#include "pyarrow/do_import_numpy.h" -#include "pyarrow/numpy_interop.h" - -int main(int argc, char** argv) { - ::testing::InitGoogleTest(&argc, argv); - - Py_Initialize(); - arrow::py::import_numpy(); - - int ret = RUN_ALL_TESTS(); - - Py_Finalize(); - - return ret; -}