-
Notifications
You must be signed in to change notification settings - Fork 4k
ARROW-13530: [C++] Implement cumulative sum compute function #12460
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
cd6550b
067f846
a747cb4
30984e1
59fad23
93644f8
dd45c3d
236d56b
19a9d05
2c3722f
73f7a32
9ff405e
4b42c8f
e318bec
940c0c2
5802d01
a4a7d37
4501d7f
634273e
fc388d7
df3e6ae
6f42a0f
56f2d78
1ceebce
0a9e1c9
5d7d2ea
671659a
a07d7a1
1086c0b
9615188
05c799d
aa27d96
f3218af
cfe8fc4
bd9f1b7
2589478
55ae02a
3d3261c
bd265d2
c53eede
cf4c652
0997113
fcd4272
eaf5f3e
1148f1e
2f3714b
c90d535
6bba2fc
58b36d5
1933da7
3667981
ae25c71
b061ab4
84bdcd7
bba5fcf
4e58857
441a812
6509bef
c596d17
16c4489
e8be46a
f825130
9d1f44f
1f2df7c
b04f898
4e3e1af
bbf7ff4
9ac5c36
e7203a0
2fe3e3a
02a54be
3673dec
2e20590
3f36557
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -188,6 +188,27 @@ class ARROW_EXPORT PartitionNthOptions : public FunctionOptions { | |
| NullPlacement null_placement; | ||
| }; | ||
|
|
||
| /// \brief Options for cumulative sum function | ||
| class ARROW_EXPORT CumulativeSumOptions : public FunctionOptions { | ||
| public: | ||
| explicit CumulativeSumOptions(double start = 0, bool skip_nulls = false, | ||
| bool check_overflow = false); | ||
| explicit CumulativeSumOptions(std::shared_ptr<Scalar> start, bool skip_nulls = false, | ||
| bool check_overflow = false); | ||
| static constexpr char const kTypeName[] = "CumulativeSumOptions"; | ||
| static CumulativeSumOptions Defaults() { return CumulativeSumOptions(); } | ||
|
|
||
| /// Optional starting value for cumulative operation computation | ||
| std::shared_ptr<Scalar> start; | ||
|
|
||
| /// If true, nulls in the input are ignored and produce a corresponding null output. | ||
| /// When false, the first null encountered is propagated through the remaining output. | ||
| bool skip_nulls = false; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The naming here is not very good because nulls are never skipped. That said, Pandas uses a similar naming and I don't have a better suggestion. @jorisvandenbossche Any opinion?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is where I took the naming from actually. |
||
|
|
||
| /// When true, returns an Invalid Status when overflow is detected | ||
| bool check_overflow = false; | ||
|
Comment on lines
+208
to
+209
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since there are two different functions ("cumulative_sum" and "cumulative_sum_checked"), I don't think it makes sense to also have an option for this. Also, it seems actually ignored...
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is inline with the existing scalar arithmetic functions that uses a |
||
| }; | ||
|
|
||
| /// @} | ||
|
|
||
| /// \brief Filter with a boolean selection filter | ||
|
|
@@ -522,6 +543,12 @@ Result<Datum> DictionaryEncode( | |
| const DictionaryEncodeOptions& options = DictionaryEncodeOptions::Defaults(), | ||
| ExecContext* ctx = NULLPTR); | ||
|
|
||
| ARROW_EXPORT | ||
| Result<Datum> CumulativeSum( | ||
| const Datum& values, | ||
| const CumulativeSumOptions& options = CumulativeSumOptions::Defaults(), | ||
| ExecContext* ctx = NULLPTR); | ||
|
|
||
| // ---------------------------------------------------------------------- | ||
| // Deprecated functions | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.