apache / apache/datafusion

Implement `array_aggregate` function

Open
#7,213 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Rust
Stars
9.3k
Forks
2.4k
Avg merge
3d 7h
Merged PRs (30d)
344

Description

### Is your feature request related to a problem or challenge?

## Summary

| Characteristic | Description |
| --------------------- | ------------------------------------------------------------------------------------------------------------------------------ |
| Function name: | `array_aggregate` |
| Aliases: | `list_aggregate`, `array_aggr`, `list_aggr` |
| Original function?: | No |
| Function Description: | DuckDB: Executes the aggregate function name on the elements of list. See the List Aggregates section for more details. |
| Sources: | [Concept](https://github.com/apache/arrow-datafusion/discussions/6855) [DuckDB](https://duckdb.org/docs/sql/functions/nested) |

## Examples:

```
D select list_aggregate([1, 2, NULL], 'min');
┌────────────────────────────────────────────────────┐
│ list_aggregate(main.list_value(1, 2, NULL), 'min') │
│ int32 │
├────────────────────────────────────────────────────┤
│ 1 │
└────────────────────────────────────────────────────┘
```

```
D select list_aggregate([1, 3, NULL, 5], 'sum');
┌───────────────────────────────────────────────────────┐
│ list_aggregate(main.list_value(1, 3, NULL, 5), 'sum') │
│ int128 │
├───────────────────────────────────────────────────────┤
│ 9 │
└───────────────────────────────────────────────────────┘
```

### Describe the solution you'd like

_No response_

### Describe alternatives you've considered

_No response_

### Additional context

_No response_

Contributor guide

Open the contributing guide

Research direction

No implementation files or test paths are named in the issue. Start by locating DataFusion's existing list functions and aggregate-function tests, then compare the requested aliases and DuckDB examples; done means array_aggregate and its listed aliases execute named aggregates over list elements with the shown NULL behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust, sql
Domain
databases
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.