Commits


Jin Shang authored and GitHub committed e3eb5898e75
GH-32190: [C++][Compute] Implement cumulative prod, max and min functions (#36020) ### Rationale for this change Implement cumulative prod, max and min compute functions ### What changes are included in this PR? 1. Add implementations, docs and tests for the three functions. 2. Refactor `CumulativeSumOptions` to `CumulativeOptions` for reusability. 3. Fix a bug where `GenericFromScalar(GenericToScalar(std::nullopt)) != std::nullopt`. 4. Remove an unnecessary Cast with the default start value. 5. Add tests to check behavior with `NaN`. I'll explain some of the changes in comments. ### Are these changes tested? Yes, in vector_accumulative_ops_test.cc and test_compute.py ### Are there any user-facing changes? No. The data members of `CumulativeSumOptions` are changed, but the member functions behave as before. And std::optional<T> also can be constructed directly from T. So users should not feel any difference. * Closes: #32190 Lead-authored-by: Jin Shang <shangjin1997@gmail.com> Co-authored-by: Benjamin Kietzman <bengilgit@gmail.com> Signed-off-by: Benjamin Kietzman <bengilgit@gmail.com>