Skip to content

Commit

Permalink
ENH: Add zero_copy_only option check
Browse files Browse the repository at this point in the history
  • Loading branch information
Licht-T authored and wesm committed Oct 27, 2017
1 parent de4ed3e commit e0561dc
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions cpp/src/arrow/python/arrow_to_pandas.cc
Original file line number Diff line number Diff line change
Expand Up @@ -968,6 +968,11 @@ class CategoricalBlock : public PandasBlock {

if (data.num_chunks() == 1 && indices_first.null_count() == 0) {
RETURN_NOT_OK(AllocateNDArrayFromIndices<T>(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));
Expand Down

0 comments on commit e0561dc

Please sign in to comment.