vibhatha commented on code in PR #36748:
URL: https://github.com/apache/arrow/pull/36748#discussion_r1273246214
##########
python/pyarrow/table.pxi:
##########
@@ -5307,8 +5307,14 @@ list[tuple(str, str, FunctionOptions)]
# Ensure aggregate function is hash_ if needed
if len(self.keys) > 0 and not func.startswith("hash_"):
func = "hash_" + func
+ import pyarrow.compute as pc
if len(self.keys) == 0 and func.startswith("hash_"):
- func = func[5:]
+ scalar_func = func[5:]
+ try:
+ pc.get_function(scalar_func)
+ func = scalar_func
+ except:
+ pass
Review Comment:
This would give an error message as shown below
```bash
E pyarrow.lib.ArrowInvalid: The provided function (hash_list) is a hash
aggregate function. Since there are no keys to group by, a scalar aggregate
function was expected (normally these do not start with hash_)
E
/Users/vibhatha/github/fork/arrow/cpp/src/arrow/acero/scalar_aggregate_node.cc:186
MakeAggregateNodeArgs(input_schema, keys, segment_keys, aggregates, exec_ctx,
concurrency, is_cpu_parallel)
E /Users/vibhatha/github/fork/arrow/cpp/src/arrow/acero/exec_plan.cc:587
MakeExecNode(this->factory_name, plan, std::move(inputs), *this->options,
registry)
E /Users/vibhatha/github/fork/arrow/cpp/src/arrow/acero/exec_plan.cc:582
std::get<Declaration>(input).AddToPlan(plan, registry)
E /Users/vibhatha/github/fork/arrow/cpp/src/arrow/acero/exec_plan.cc:660
with_sink.AddToPlan(exec_plan.get())
```
--
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]