Skip to content

Commit 0b10a90

Browse files
committed
Improve bindings
1 parent 3f09582 commit 0b10a90

File tree

2 files changed

+8
-11
lines changed

2 files changed

+8
-11
lines changed

python/pyarrow/_compute.pyx

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1445,14 +1445,12 @@ class RunEndEncodeOptions(_RunEndEncodeOptions):
14451445

14461446

14471447
cdef class _InversePermutationOptions(FunctionOptions):
1448-
def _set_options(self, max_index, output_type):
1449-
if output_type is None:
1450-
self.wrapped.reset(new CInversePermutationOptions(max_index))
1451-
else:
1452-
output_ty = ensure_type(output_type)
1453-
self.wrapped.reset(
1454-
new CInversePermutationOptions(max_index,
1455-
pyarrow_unwrap_data_type(output_ty)))
1448+
def _set_options(self, max_index=-1, output_type=None):
1449+
cdef optional[shared_ptr[CDataType]] c_output_type = nullopt
1450+
if output_type is not None:
1451+
c_output_type = pyarrow_unwrap_data_type(ensure_type(output_type))
1452+
self.wrapped.reset(
1453+
new CInversePermutationOptions(max_index, c_output_type))
14561454

14571455

14581456
class InversePermutationOptions(_InversePermutationOptions):
@@ -1467,7 +1465,7 @@ class InversePermutationOptions(_InversePermutationOptions):
14671465
If negative, this value will be set to the length of the input indices
14681466
minus 1 and the length of the function’s output will be the length
14691467
of the input indices.
1470-
output_type : Optional[DataType], default None
1468+
output_type : DataType, default None
14711469
The type of the output inverse permutation.
14721470
If None, the output will be of the same type as the input indices, otherwise
14731471
must be signed integer type. An invalid error will be reported if this type

python/pyarrow/includes/libarrow.pxd

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2590,8 +2590,7 @@ cdef extern from "arrow/compute/api.h" namespace "arrow::compute" nogil:
25902590

25912591
cdef cppclass CInversePermutationOptions \
25922592
"arrow::compute::InversePermutationOptions"(CFunctionOptions):
2593-
CInversePermutationOptions(int64_t max_index)
2594-
CInversePermutationOptions(int64_t max_index, shared_ptr[CDataType] output_type)
2593+
CInversePermutationOptions(int64_t max_index, optional[shared_ptr[CDataType]] output_type)
25952594
int64_t max_index
25962595
optional[shared_ptr[CDataType]] output_type
25972596

0 commit comments

Comments
 (0)