pitrou commented on a change in pull request #11147:
URL: https://github.com/apache/arrow/pull/11147#discussion_r712921002



##########
File path: python/pyarrow/_compute.pyx
##########
@@ -980,51 +973,45 @@ cdef class _ModeOptions(FunctionOptions):
 
 
 class ModeOptions(_ModeOptions):
-    def __init__(self, n=1, skip_nulls=True, min_count=0):
+    def __init__(self, n=1, *, skip_nulls=True, min_count=0):
         self._set_options(n, skip_nulls, min_count)
 
 
 cdef class _SetLookupOptions(FunctionOptions):
-    cdef:
-        unique_ptr[CDatum] valset
-
     def _set_options(self, value_set, c_bool skip_nulls):
+        cdef unique_ptr[CDatum] valset
         if isinstance(value_set, Array):
-            self.valset.reset(new CDatum((<Array> value_set).sp_array))
+            valset.reset(new CDatum((<Array> value_set).sp_array))
         elif isinstance(value_set, ChunkedArray):
-            self.valset.reset(
-                new CDatum((<ChunkedArray> value_set).sp_chunked_array)
-            )
+            valset.reset(
+                new CDatum((<ChunkedArray> value_set).sp_chunked_array))
         elif isinstance(value_set, Scalar):
-            self.valset.reset(new CDatum((<Scalar> value_set).unwrap()))
+            valset.reset(new CDatum((<Scalar> value_set).unwrap()))
         else:
-            raise ValueError('"{}" is not a valid value_set'.format(value_set))
-
-        self.wrapped.reset(
-            new CSetLookupOptions(deref(self.valset), skip_nulls))
+            _raise_invalid_function_option(value_set, "value set",
+                                           error="type")

Review comment:
       If the type is the problem, then perhaps `TypeError` should be raised, 
not `ValueError`?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to