apache / apache/arrow

`table.group_by([]).aggregate` raises an error on some aggregate functions.

Open
#36,149 1 comment 0 reactions 0 assignees View on GitHub
Component: C++ Component: Python Type: bug
Dominant language
C++
Stars
17.1k
Forks
4.3k
Avg merge
3d 13h
Merged PRs (30d)
88

Description

### Describe the bug, including details regarding any error messages, version, and platform.

Grouping on empty keys aggregates against the whole table (relates to #14896). But there are 3 hash aggregate functions which do not have corresponding scalar aggregate functions: `hash_distinct`, `hash_list`, and `hash_one`. Grouping on empty keys with those raises a key error.
```python
In []: table = pa.table({'key': list('aba'), 'value': [0, 1, 2]})

In []: table.group_by(['key']).aggregate([('value', 'list')])
Out[]:
pyarrow.Table
key: string
value_list: list
child 0, item: int64
----
key: [["a","b"]]
value_list: [[[0,2],[1]]]

In []: table.group_by([]).aggregate([('value', 'list')])
...
ArrowKeyError: No function registered with name: list

In []: table.group_by([]).aggregate([('value', 'min')])
Out[]:
pyarrow.Table
value_min: int64
----
value_min: [[0]]
```

### Component(s)

C++, Python

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.