Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 57 additions & 0 deletions cpp/src/arrow/array-struct-test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,63 @@ void ValidateBasicStructArray(const StructArray* result,
}
}

TEST(StructArray, FromFieldNames) {
std::shared_ptr<Array> a, b, c, array, expected;
a = ArrayFromJSON(int32(), "[4, null]");
b = ArrayFromJSON(utf8(), R"([null, "foo"])");

auto res = StructArray::Make({a, b}, {"a", "b"});
ASSERT_OK(res);
Comment thread
pitrou marked this conversation as resolved.
Outdated
array = *res;
expected = ArrayFromJSON(struct_({field("a", int32()), field("b", utf8())}),
R"([{"a": 4, "b": null}, {"a": null, "b": "foo"}])");
AssertArraysEqual(*array, *expected);

// With non-zero offsets
res = StructArray::Make({a, b}, {"a", "b"}, /*null_bitmap =*/nullptr, /*null_count =*/0,
/*offset =*/1);
ASSERT_OK(res);
array = *res;
expected = ArrayFromJSON(struct_({field("a", int32()), field("b", utf8())}),
R"([{"a": null, "b": "foo"}])");
AssertArraysEqual(*array, *expected);

Comment thread
pitrou marked this conversation as resolved.
Outdated
res = StructArray::Make({a, b}, {"a", "b"}, /*null_bitmap =*/nullptr, /*null_count =*/0,
/*offset =*/2);
ASSERT_OK(res);
array = *res;
expected = ArrayFromJSON(struct_({field("a", int32()), field("b", utf8())}), R"([])");
AssertArraysEqual(*array, *expected);

// Offset greater than length
res = StructArray::Make({a, b}, {"a", "b"}, /*null_bitmap =*/nullptr, /*null_count =*/0,
/*offset =*/3);
ASSERT_RAISES(IndexError, res);

// With null bitmap
std::shared_ptr<Buffer> null_bitmap;
BitmapFromVector<bool>({false, true}, &null_bitmap);
res = StructArray::Make({a, b}, {"a", "b"}, null_bitmap);
ASSERT_OK(res);
array = *res;
expected = ArrayFromJSON(struct_({field("a", int32()), field("b", utf8())}),
R"([null, {"a": null, "b": "foo"}])");
AssertArraysEqual(*array, *expected);

// Mismatching array lengths
c = ArrayFromJSON(int64(), "[1, 2, 3]");
res = StructArray::Make({a, c}, {"a", "c"});
ASSERT_RAISES(Invalid, res);

// Mismatching number of fields
res = StructArray::Make({a, b}, {"a", "b", "c"});
Comment thread
pitrou marked this conversation as resolved.
Outdated
ASSERT_RAISES(Invalid, res);

// Fail on 0 children (cannot infer array length)
res = StructArray::Make({}, {});
ASSERT_RAISES(Invalid, res);
}

// ----------------------------------------------------------------------------------
// Struct test
class TestStructBuilder : public TestBuilder {
Expand Down
1 change: 1 addition & 0 deletions cpp/src/arrow/array-view-test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include "arrow/testing/gtest_util.h"
#include "arrow/testing/util.h"
#include "arrow/type.h"
#include "arrow/util/logging.h"

namespace arrow {

Expand Down
28 changes: 28 additions & 0 deletions cpp/src/arrow/array.cc
Original file line number Diff line number Diff line change
Expand Up @@ -482,6 +482,34 @@ StructArray::StructArray(const std::shared_ptr<DataType>& type, int64_t length,
boxed_fields_.resize(children.size());
}

Result<std::shared_ptr<Array>> StructArray::Make(
const std::vector<std::shared_ptr<Array>>& children,
const std::vector<std::string>& field_names, std::shared_ptr<Buffer> null_bitmap,
Comment thread
pitrou marked this conversation as resolved.
Outdated
int64_t null_count, int64_t offset) {
if (children.size() != field_names.size()) {
return Status::Invalid("Mismatching number of field names and child arrays");
}
int64_t length = 0;
if (children.size() == 0) {
return Status::Invalid("Can't infer struct array length with 0 child arrays");
}
length = children.front()->length();
for (const auto& child : children) {
if (length != child->length()) {
return Status::Invalid("Mismatching child array lengths");
}
}
if (offset > length) {
return Status::IndexError("Offset greater than length of child arrays");
}
std::vector<std::shared_ptr<Field>> fields(children.size());
for (size_t i = 0; i < children.size(); ++i) {
fields[i] = ::arrow::field(field_names[i], children[i]->type());
}
return std::make_shared<StructArray>(struct_(fields), length - offset, children,
null_bitmap, null_count, offset);
}

const StructType* StructArray::struct_type() const {
return checked_cast<const StructType*>(data_->type.get());
}
Expand Down
12 changes: 12 additions & 0 deletions cpp/src/arrow/array.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@

#include "arrow/buffer.h"
#include "arrow/compare.h"
#include "arrow/result.h"
#include "arrow/type.h"
#include "arrow/type_traits.h"
#include "arrow/util/bit-util.h"
Expand Down Expand Up @@ -816,6 +817,16 @@ class ARROW_EXPORT StructArray : public Array {
std::shared_ptr<Buffer> null_bitmap = NULLPTR,
int64_t null_count = kUnknownNullCount, int64_t offset = 0);

/// \brief Return a StructArray from child arrays and field names.
///
/// The length and data type are automatically inferred from the arguments.
/// There should be at least one child array.
static Result<std::shared_ptr<Array>> Make(
const std::vector<std::shared_ptr<Array>>& children,
const std::vector<std::string>& field_names,
std::shared_ptr<Buffer> null_bitmap = NULLPTR,
int64_t null_count = kUnknownNullCount, int64_t offset = 0);

const StructType* struct_type() const;

// Return a shared pointer in case the requestor desires to share ownership
Expand All @@ -834,6 +845,7 @@ class ARROW_EXPORT StructArray : public Array {

private:
// For caching boxed child data
// XXX This is not handled in a thread-safe manner.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this a TODO? Maybe open a JIRA?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mutable std::vector<std::shared_ptr<Array>> boxed_fields_;
};

Expand Down
6 changes: 3 additions & 3 deletions cpp/src/arrow/compute/kernels/cast-test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,10 @@ class TestCast : public ComputeFixture, public TestBase {
const std::vector<I_TYPE>& in_values, const std::vector<bool>& is_valid,
const std::shared_ptr<DataType>& out_type,
const std::vector<O_TYPE>& out_values, const CastOptions& options) {
DCHECK_EQ(in_values.size(), out_values.size());
ASSERT_EQ(in_values.size(), out_values.size());
std::shared_ptr<Array> input, expected;
if (is_valid.size() > 0) {
DCHECK_EQ(is_valid.size(), out_values.size());
ASSERT_EQ(is_valid.size(), out_values.size());
ArrayFromVector<InType, I_TYPE>(in_type, is_valid, in_values, &input);
ArrayFromVector<OutType, O_TYPE>(out_type, is_valid, out_values, &expected);
} else {
Expand All @@ -123,7 +123,7 @@ class TestCast : public ComputeFixture, public TestBase {
const CastOptions& options = CastOptions()) {
std::shared_ptr<Array> input = ArrayFromJSON(in_type, in_json);
std::shared_ptr<Array> expected = ArrayFromJSON(out_type, expected_json);
DCHECK_EQ(input->length(), expected->length());
ASSERT_EQ(input->length(), expected->length());
CheckPass(*input, *expected, out_type, options);

// Check a sliced variant
Expand Down
1 change: 1 addition & 0 deletions cpp/src/arrow/csv/converter-test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#include "arrow/testing/gtest_util.h"
#include "arrow/type.h"
#include "arrow/util/decimal.h"
#include "arrow/util/logging.h"

namespace arrow {
namespace csv {
Expand Down
1 change: 1 addition & 0 deletions cpp/src/arrow/extension_type-test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
#include "arrow/testing/util.h"
#include "arrow/type.h"
#include "arrow/util/key_value_metadata.h"
#include "arrow/util/logging.h"

namespace arrow {

Expand Down
2 changes: 1 addition & 1 deletion cpp/src/arrow/flight/flight-test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ class TestFlightClient : public ::testing::Test {
void CheckDoGet(const FlightDescriptor& descr, const BatchVector& expected_batches,
EndpointCheckFunc&& check_endpoints) {
auto num_batches = static_cast<int>(expected_batches.size());
DCHECK_GE(num_batches, 2);
ASSERT_GE(num_batches, 2);
auto expected_schema = expected_batches[0]->schema();

std::unique_ptr<FlightInfo> info;
Expand Down
17 changes: 17 additions & 0 deletions cpp/src/arrow/python/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,15 @@
#include "arrow/python/config.h"

#include "arrow/buffer.h"
#include "arrow/python/pyarrow.h"
#include "arrow/python/visibility.h"
#include "arrow/util/macros.h"

namespace arrow {

class MemoryPool;
template <class T>
class Result;

namespace py {

Expand All @@ -52,6 +55,20 @@ ARROW_PYTHON_EXPORT Status PassPyError();

#define PY_RETURN_IF_ERROR(CODE) ARROW_RETURN_NOT_OK(CheckPyError(CODE));

// For Cython, as you can't define template C++ functions in Cython, only use them.
// This function can set a Python exception. It assumes that T has a (cheap)
// default constructor.
template <class T>
T GetResultValue(Result<T>& result) {
if (ARROW_PREDICT_TRUE(result.ok())) {
return *std::move(result);
} else {
int r = internal::check_status(result.status());
assert(r == -1); // should have errored out
return {};
}
}

// A RAII-style helper that ensures the GIL is acquired inside a lexical block.
class ARROW_PYTHON_EXPORT PyAcquireGIL {
public:
Expand Down
5 changes: 5 additions & 0 deletions cpp/src/arrow/python/pyarrow.cc
Original file line number Diff line number Diff line change
Expand Up @@ -168,5 +168,10 @@ PyObject* wrap_record_batch(const std::shared_ptr<RecordBatch>& batch) {
return ::pyarrow_wrap_batch(batch);
}

namespace internal {

int check_status(const Status& status) { return ::pyarrow_internal_check_status(status); }

} // namespace internal
} // namespace py
} // namespace arrow
5 changes: 5 additions & 0 deletions cpp/src/arrow/python/pyarrow.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,11 @@ ARROW_PYTHON_EXPORT Status unwrap_record_batch(PyObject* batch,
ARROW_PYTHON_EXPORT PyObject* wrap_record_batch(
const std::shared_ptr<RecordBatch>& batch);

namespace internal {

ARROW_PYTHON_EXPORT int check_status(const Status& status);

} // namespace internal
} // namespace py
} // namespace arrow

Expand Down
18 changes: 14 additions & 4 deletions cpp/src/arrow/python/pyarrow_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,22 @@
// under the License.

// DO NOT EDIT THIS FILE. Update from pyarrow/lib_api.h after pyarrow build
// This is used to be able to call back into Cython code from C++.

/* Generated by Cython 0.29 */
/* Generated by Cython 0.29.8 */
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why are do we check in this generated code?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It has to be installed with the C++ library, right now the C++ build system doesn't know how to invoke Cython. This might be improved later

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a bit more fundamental: these files are generated by Cython and included by our C++ code, but Cython needs the C++ code to be compiled for linking. So there's a circular dependency.


#ifndef __PYX_HAVE_API__pyarrow__lib
#define __PYX_HAVE_API__pyarrow__lib
#ifdef __MINGW64__
#define MS_WIN64
#endif
#include "Python.h"
#include "pyarrow_lib.h"

static PyObject *(*__pyx_api_f_7pyarrow_3lib_pyarrow_wrap_array)(std::shared_ptr< arrow::Array> const &) = 0;
#define pyarrow_wrap_array __pyx_api_f_7pyarrow_3lib_pyarrow_wrap_array
static PyObject *(*__pyx_api_f_7pyarrow_3lib_pyarrow_wrap_chunked_array)(std::shared_ptr< arrow::ChunkedArray> const &) = 0;
#define pyarrow_wrap_chunked_array __pyx_api_f_7pyarrow_3lib_pyarrow_wrap_chunked_array
static PyObject *(*__pyx_api_f_7pyarrow_3lib_pyarrow_wrap_batch)(std::shared_ptr< arrow::RecordBatch> const &) = 0;
#define pyarrow_wrap_batch __pyx_api_f_7pyarrow_3lib_pyarrow_wrap_batch
static PyObject *(*__pyx_api_f_7pyarrow_3lib_pyarrow_wrap_buffer)(std::shared_ptr< arrow::Buffer> const &) = 0;
Expand Down Expand Up @@ -62,6 +68,8 @@ static std::shared_ptr< arrow::Table> (*__pyx_api_f_7pyarrow_3lib_pyarrow_unwra
#define pyarrow_unwrap_table __pyx_api_f_7pyarrow_3lib_pyarrow_unwrap_table
static std::shared_ptr< arrow::Tensor> (*__pyx_api_f_7pyarrow_3lib_pyarrow_unwrap_tensor)(PyObject *) = 0;
#define pyarrow_unwrap_tensor __pyx_api_f_7pyarrow_3lib_pyarrow_unwrap_tensor
static int (*__pyx_api_f_7pyarrow_3lib_pyarrow_internal_check_status)(arrow::Status const &) = 0;
#define pyarrow_internal_check_status __pyx_api_f_7pyarrow_3lib_pyarrow_internal_check_status
static int (*__pyx_api_f_7pyarrow_3lib_pyarrow_is_buffer)(PyObject *) = 0;
#define pyarrow_is_buffer __pyx_api_f_7pyarrow_3lib_pyarrow_is_buffer
static int (*__pyx_api_f_7pyarrow_3lib_pyarrow_is_data_type)(PyObject *) = 0;
Expand All @@ -72,8 +80,8 @@ static int (*__pyx_api_f_7pyarrow_3lib_pyarrow_is_schema)(PyObject *) = 0;
#define pyarrow_is_schema __pyx_api_f_7pyarrow_3lib_pyarrow_is_schema
static int (*__pyx_api_f_7pyarrow_3lib_pyarrow_is_array)(PyObject *) = 0;
#define pyarrow_is_array __pyx_api_f_7pyarrow_3lib_pyarrow_is_array
static PyObject *(*__pyx_api_f_7pyarrow_3lib_pyarrow_wrap_chunked_array)(std::shared_ptr< arrow::ChunkedArray> const &) = 0;
#define pyarrow_wrap_chunked_array __pyx_api_f_7pyarrow_3lib_pyarrow_wrap_chunked_array
static PyObject *(*__pyx_api_f_7pyarrow_3lib_pyarrow_wrap_scalar)(std::shared_ptr< arrow::Scalar> const &) = 0;
#define pyarrow_wrap_scalar __pyx_api_f_7pyarrow_3lib_pyarrow_wrap_scalar
static int (*__pyx_api_f_7pyarrow_3lib_pyarrow_is_tensor)(PyObject *) = 0;
#define pyarrow_is_tensor __pyx_api_f_7pyarrow_3lib_pyarrow_is_tensor
static int (*__pyx_api_f_7pyarrow_3lib_pyarrow_is_column)(PyObject *) = 0;
Expand Down Expand Up @@ -149,6 +157,7 @@ static int import_pyarrow__lib(void) {
module = PyImport_ImportModule("pyarrow.lib");
if (!module) goto bad;
if (__Pyx_ImportFunction(module, "pyarrow_wrap_array", (void (**)(void))&__pyx_api_f_7pyarrow_3lib_pyarrow_wrap_array, "PyObject *(std::shared_ptr< arrow::Array> const &)") < 0) goto bad;
if (__Pyx_ImportFunction(module, "pyarrow_wrap_chunked_array", (void (**)(void))&__pyx_api_f_7pyarrow_3lib_pyarrow_wrap_chunked_array, "PyObject *(std::shared_ptr< arrow::ChunkedArray> const &)") < 0) goto bad;
if (__Pyx_ImportFunction(module, "pyarrow_wrap_batch", (void (**)(void))&__pyx_api_f_7pyarrow_3lib_pyarrow_wrap_batch, "PyObject *(std::shared_ptr< arrow::RecordBatch> const &)") < 0) goto bad;
if (__Pyx_ImportFunction(module, "pyarrow_wrap_buffer", (void (**)(void))&__pyx_api_f_7pyarrow_3lib_pyarrow_wrap_buffer, "PyObject *(std::shared_ptr< arrow::Buffer> const &)") < 0) goto bad;
if (__Pyx_ImportFunction(module, "pyarrow_wrap_column", (void (**)(void))&__pyx_api_f_7pyarrow_3lib_pyarrow_wrap_column, "PyObject *(std::shared_ptr< arrow::Column> const &)") < 0) goto bad;
Expand All @@ -167,12 +176,13 @@ static int import_pyarrow__lib(void) {
if (__Pyx_ImportFunction(module, "pyarrow_unwrap_schema", (void (**)(void))&__pyx_api_f_7pyarrow_3lib_pyarrow_unwrap_schema, "std::shared_ptr< arrow::Schema> (PyObject *)") < 0) goto bad;
if (__Pyx_ImportFunction(module, "pyarrow_unwrap_table", (void (**)(void))&__pyx_api_f_7pyarrow_3lib_pyarrow_unwrap_table, "std::shared_ptr< arrow::Table> (PyObject *)") < 0) goto bad;
if (__Pyx_ImportFunction(module, "pyarrow_unwrap_tensor", (void (**)(void))&__pyx_api_f_7pyarrow_3lib_pyarrow_unwrap_tensor, "std::shared_ptr< arrow::Tensor> (PyObject *)") < 0) goto bad;
if (__Pyx_ImportFunction(module, "pyarrow_internal_check_status", (void (**)(void))&__pyx_api_f_7pyarrow_3lib_pyarrow_internal_check_status, "int (arrow::Status const &)") < 0) goto bad;
if (__Pyx_ImportFunction(module, "pyarrow_is_buffer", (void (**)(void))&__pyx_api_f_7pyarrow_3lib_pyarrow_is_buffer, "int (PyObject *)") < 0) goto bad;
if (__Pyx_ImportFunction(module, "pyarrow_is_data_type", (void (**)(void))&__pyx_api_f_7pyarrow_3lib_pyarrow_is_data_type, "int (PyObject *)") < 0) goto bad;
if (__Pyx_ImportFunction(module, "pyarrow_is_field", (void (**)(void))&__pyx_api_f_7pyarrow_3lib_pyarrow_is_field, "int (PyObject *)") < 0) goto bad;
if (__Pyx_ImportFunction(module, "pyarrow_is_schema", (void (**)(void))&__pyx_api_f_7pyarrow_3lib_pyarrow_is_schema, "int (PyObject *)") < 0) goto bad;
if (__Pyx_ImportFunction(module, "pyarrow_is_array", (void (**)(void))&__pyx_api_f_7pyarrow_3lib_pyarrow_is_array, "int (PyObject *)") < 0) goto bad;
if (__Pyx_ImportFunction(module, "pyarrow_wrap_chunked_array", (void (**)(void))&__pyx_api_f_7pyarrow_3lib_pyarrow_wrap_chunked_array, "PyObject *(std::shared_ptr< arrow::ChunkedArray> const &)") < 0) goto bad;
if (__Pyx_ImportFunction(module, "pyarrow_wrap_scalar", (void (**)(void))&__pyx_api_f_7pyarrow_3lib_pyarrow_wrap_scalar, "PyObject *(std::shared_ptr< arrow::Scalar> const &)") < 0) goto bad;
if (__Pyx_ImportFunction(module, "pyarrow_is_tensor", (void (**)(void))&__pyx_api_f_7pyarrow_3lib_pyarrow_is_tensor, "int (PyObject *)") < 0) goto bad;
if (__Pyx_ImportFunction(module, "pyarrow_is_column", (void (**)(void))&__pyx_api_f_7pyarrow_3lib_pyarrow_is_column, "int (PyObject *)") < 0) goto bad;
if (__Pyx_ImportFunction(module, "pyarrow_is_table", (void (**)(void))&__pyx_api_f_7pyarrow_3lib_pyarrow_is_table, "int (PyObject *)") < 0) goto bad;
Expand Down
13 changes: 2 additions & 11 deletions cpp/src/arrow/python/pyarrow_lib.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

// DO NOT EDIT THIS FILE. Update from pyarrow/lib.h after pyarrow build

/* Generated by Cython 0.29 */
/* Generated by Cython 0.29.8 */

#ifndef __PYX_HAVE__pyarrow__lib
#define __PYX_HAVE__pyarrow__lib
Expand All @@ -38,6 +38,7 @@
#endif

__PYX_EXTERN_C PyObject *__pyx_f_7pyarrow_3lib_pyarrow_wrap_array(std::shared_ptr< arrow::Array> const &);
__PYX_EXTERN_C PyObject *__pyx_f_7pyarrow_3lib_pyarrow_wrap_chunked_array(std::shared_ptr< arrow::ChunkedArray> const &);
__PYX_EXTERN_C PyObject *__pyx_f_7pyarrow_3lib_pyarrow_wrap_batch(std::shared_ptr< arrow::RecordBatch> const &);
__PYX_EXTERN_C PyObject *__pyx_f_7pyarrow_3lib_pyarrow_wrap_buffer(std::shared_ptr< arrow::Buffer> const &);
__PYX_EXTERN_C PyObject *__pyx_f_7pyarrow_3lib_pyarrow_wrap_column(std::shared_ptr< arrow::Column> const &);
Expand All @@ -56,16 +57,6 @@ __PYX_EXTERN_C std::shared_ptr< arrow::Field> __pyx_f_7pyarrow_3lib_pyarrow_unw
__PYX_EXTERN_C std::shared_ptr< arrow::Schema> __pyx_f_7pyarrow_3lib_pyarrow_unwrap_schema(PyObject *);
__PYX_EXTERN_C std::shared_ptr< arrow::Table> __pyx_f_7pyarrow_3lib_pyarrow_unwrap_table(PyObject *);
__PYX_EXTERN_C std::shared_ptr< arrow::Tensor> __pyx_f_7pyarrow_3lib_pyarrow_unwrap_tensor(PyObject *);
__PYX_EXTERN_C int pyarrow_is_buffer(PyObject *);
__PYX_EXTERN_C int pyarrow_is_data_type(PyObject *);
__PYX_EXTERN_C int pyarrow_is_field(PyObject *);
__PYX_EXTERN_C int pyarrow_is_schema(PyObject *);
__PYX_EXTERN_C int pyarrow_is_array(PyObject *);
__PYX_EXTERN_C PyObject *pyarrow_wrap_chunked_array(std::shared_ptr< arrow::ChunkedArray> const &);
__PYX_EXTERN_C int pyarrow_is_tensor(PyObject *);
__PYX_EXTERN_C int pyarrow_is_column(PyObject *);
__PYX_EXTERN_C int pyarrow_is_table(PyObject *);
__PYX_EXTERN_C int pyarrow_is_batch(PyObject *);

#endif /* !__PYX_HAVE_API__pyarrow__lib */

Expand Down
1 change: 1 addition & 0 deletions cpp/src/arrow/python/python-test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
#include "arrow/python/helpers.h"
#include "arrow/python/python_to_arrow.h"
#include "arrow/util/checked_cast.h"
#include "arrow/util/logging.h"

namespace arrow {

Expand Down
8 changes: 8 additions & 0 deletions cpp/src/arrow/result.h
Original file line number Diff line number Diff line change
Expand Up @@ -333,4 +333,12 @@ class Result {
#define ARROW_ASSIGN_OR_RAISE(lhs, rexpr) \
ARROW_ASSIGN_OR_RAISE_IMPL(ARROW_ASSIGN_OR_RAISE_NAME(_error_or_value, __COUNTER__), \
lhs, rexpr);

namespace internal {

// For Cython, because of https://github.com/cython/cython/issues/3018
template <class T>
using CResult = Result<T>;

} // namespace internal
} // namespace arrow
Loading