From e0561dc65dac23879453f7f1e40f9ec4d915d48d Mon Sep 17 00:00:00 2001 From: Licht-T Date: Fri, 27 Oct 2017 01:29:11 +0900 Subject: [PATCH] ENH: Add zero_copy_only option check --- cpp/src/arrow/python/arrow_to_pandas.cc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cpp/src/arrow/python/arrow_to_pandas.cc b/cpp/src/arrow/python/arrow_to_pandas.cc index 9e47b3437303c..74b75bcce6207 100644 --- a/cpp/src/arrow/python/arrow_to_pandas.cc +++ b/cpp/src/arrow/python/arrow_to_pandas.cc @@ -968,6 +968,11 @@ class CategoricalBlock : public PandasBlock { if (data.num_chunks() == 1 && indices_first.null_count() == 0) { RETURN_NOT_OK(AllocateNDArrayFromIndices(npy_type, indices_first)); + } else if (options_.zero_copy_only) { + std::stringstream ss; + ss << "Needed to copy " << data.num_chunks() << " chunks with " + << indices_first.null_count() << " indices nulls, but zero_copy_only was True"; + return Status::Invalid(ss.str()); } else { RETURN_NOT_OK(AllocateNDArray(npy_type, 1));