R-JunmingChen commented on code in PR #36977:
URL: https://github.com/apache/arrow/pull/36977#discussion_r1281304010
##########
python/pyarrow/_compute.pyx:
##########
@@ -1933,6 +1933,34 @@ class PartitionNthOptions(_PartitionNthOptions):
self._set_options(pivot, null_placement)
+cdef class _CumulativeSumOptions(FunctionOptions):
+ def _set_options(self, start, skip_nulls):
+ if not isinstance(start, Scalar):
+ try:
+ start = lib.scalar(start)
+ except Exception:
+ _raise_invalid_function_option(
+ start, "`start` type for CumulativeSumOptions", TypeError)
+
+ self.wrapped.reset(new
CCumulativeOptions(pyarrow_unwrap_scalar(start), skip_nulls))
+
+
+class CumulativeSumOptions(_CumulativeSumOptions):
+ """
+ Options for `cumulative_sum` function.
+
+ Parameters
+ ----------
+ start : Scalar, default 0.0
+ Starting value for sum computation
+ skip_nulls : bool, default False
+ When false, the first encountered null is propagated.
+ """
+
+ def __init__(self, start=0.0, *, skip_nulls=False):
+ self._set_options(start, skip_nulls)
+
Review Comment:
Hi, I am not sure how to use `_deprecate_class`, which doesn't look like a
decorator. It seems that we can use like this and add it to _compute.py:
`CumulativeSumOptions = _deprecate_class("CumulativeSumOptions",
CumulativeOptions, 14)`
However, it can't be referenced when using CumulativeSumOptions with
pyarrow.compute CumulativeSumOptions.
--
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]