felipecrv commented on code in PR #15083:
URL: https://github.com/apache/arrow/pull/15083#discussion_r1063465657
##########
cpp/src/arrow/compute/api_aggregate.h:
##########
@@ -186,16 +188,38 @@ class ARROW_EXPORT IndexOptions : public FunctionOptions {
/// \brief Configure a grouped aggregation
struct ARROW_EXPORT Aggregate {
+ Aggregate() = default;
+
+ Aggregate(std::string function, std::shared_ptr<FunctionOptions> options,
+ std::vector<FieldRef> target, std::string name = "")
+ : function(std::move(function)),
+ options(std::move(options)),
+ target(std::move(target)),
+ name(std::move(name)) {}
+
+ Aggregate(std::string function, std::shared_ptr<FunctionOptions> options,
+ FieldRef target, std::string name = "")
+ : Aggregate(std::move(function), std::move(options),
+ /*target=*/std::vector<FieldRef>{std::move(target)},
std::move(name)) {}
+
+ Aggregate(std::string function, FieldRef target, std::string name)
+ : Aggregate(std::move(function), /*options=*/NULLPTR,
+ /*target=*/std::vector<FieldRef>{std::move(target)},
std::move(name)) {}
+
+ Aggregate(std::string function, std::string name)
+ : Aggregate(std::move(function), /*options=*/NULLPTR,
+ /*target=*/std::vector<FieldRef>{}, std::move(name)) {}
+
/// the name of the aggregation function
std::string function;
/// options for the aggregation function
std::shared_ptr<FunctionOptions> options;
- // fields to which aggregations will be applied
- FieldRef target;
+ /// zero or more fields to which aggregations will be applied
+ std::vector<FieldRef> target;
Review Comment:
I thought about pluralizing this but it became useful to refer to this as
the individual target when processing multiple aggregate calls -- each one with
its own target. A names that is pluralizable here is nice because of that. So
keeping `target` or renaming it to something like `target_bundle`, `target_set`
would keep the code that process this more understandable.
--
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]