felipecrv commented on code in PR #15083:
URL: https://github.com/apache/arrow/pull/15083#discussion_r1064884518
##########
cpp/src/arrow/engine/substrait/extension_set.cc:
##########
@@ -883,21 +883,37 @@ ExtensionIdRegistry::SubstraitCallToArrow
DecodeConcatMapping() {
ExtensionIdRegistry::SubstraitAggregateToArrow DecodeBasicAggregate(
const std::string& arrow_function_name) {
return [arrow_function_name](const SubstraitCall& call) ->
Result<compute::Aggregate> {
- if (call.size() != 1) {
- return Status::NotImplemented(
- "Only unary aggregate functions are currently supported");
- }
- ARROW_ASSIGN_OR_RAISE(compute::Expression arg, call.GetValueArg(0));
- const FieldRef* arg_ref = arg.field_ref();
- if (!arg_ref) {
- return Status::Invalid("Expected an aggregate call ", call.id().uri, "#",
- call.id().name, " to have a direct reference");
- }
- std::string fixed_arrow_func = arrow_function_name;
+ std::string fixed_arrow_func;
if (call.is_hash()) {
- fixed_arrow_func = "hash_" + arrow_function_name;
+ fixed_arrow_func = "hash_";
}
- return compute::Aggregate{std::move(fixed_arrow_func), nullptr, *arg_ref,
""};
+
+ switch (call.size()) {
+ case 0: {
+ if (call.id().name == "count") {
+ fixed_arrow_func += "count_all";
+ return compute::Aggregate{std::move(fixed_arrow_func), ""};
+ }
+ return Status::Invalid("Expected aggregate call ", call.id().uri, "#",
+ call.id().name, " to have at least one
argument");
Review Comment:
Exactly.
--
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]