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



##########
File path: python/pyarrow/_compute.pyx
##########
@@ -844,53 +846,52 @@ class ExtractRegexOptions(_ExtractRegexOptions):
 
 
 cdef class _SliceOptions(FunctionOptions):
-    def _set_options(self, int64_t start, int64_t stop, int64_t step):
+    def _set_options(self, start, stop, step):
         self.wrapped.reset(new CSliceOptions(start, stop, step))
 
 
 class SliceOptions(_SliceOptions):
-    def __init__(self, int64_t start, int64_t stop=sys.maxsize,
-                 int64_t step=1):
+    def __init__(self, start, stop=sys.maxsize, step=1):
         self._set_options(start, stop, step)
 
 
 cdef class _FilterOptions(FunctionOptions):
-    def _set_options(self, null_selection_behavior):
-        if null_selection_behavior == 'drop':
-            self.wrapped.reset(
-                new CFilterOptions(CFilterNullSelectionBehavior_DROP))
-        elif null_selection_behavior == 'emit_null':
-            self.wrapped.reset(
-                new CFilterOptions(CFilterNullSelectionBehavior_EMIT_NULL))
-        else:
+    null_selection_dict = {
+        "drop": CFilterNullSelectionBehavior_DROP,
+        "emit_null": CFilterNullSelectionBehavior_EMIT_NULL,
+    }
+
+    def _set_options(self, null_selection):
+        if null_selection not in null_selection_dict:
             raise ValueError(
-                '"{}" is not a valid null_selection_behavior'
-                .format(null_selection_behavior))
+                f'"{null_selection}" is not a valid null_selection_behavior')
+        self.wrapped.reset(
+            new CFilterOptions(null_selection_dict[null_selection])
+        )
 
 
 class FilterOptions(_FilterOptions):
-    def __init__(self, null_selection_behavior='drop'):
-        self._set_options(null_selection_behavior)
+    def __init__(self, null_selection="drop"):

Review comment:
       Yes, for symmetry it would have been better to not include the 
`_behavior` part but given that this was existing code and there might already 
be users expecting this API, I will revert this change to how it was before 
this PR.




-- 
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