ClickHouse / ClickHouse/ClickHouse

Unexpected behavior of groupConcat function when using null in expression

Open
#69,195 0 comments 0 reactions 0 assignees View on GitHub
comp-aggregate-functions external unexpected behaviour
Dominant language
C++
Stars
49.9k
Forks
9k
Avg merge
21h 32m
Merged PRs (30d)
515

Description

https://fiddle.clickhouse.com/6d549ea8-70c0-4d27-a80d-6ad0bee88f9c

```sql
create table t (a Nullable(String)) engine MergeTree order by ();

insert into t values ('123'), ('456'), ('789');

select groupConcat(',', 1, 1, 1, 1)(a, null, a, a, 1, 1) from t;
```

Output:
```
\N
```

Why I do not get an exception executing this invalid query?

I expect to see either

```
DB::Exception: Incorrect number of parameters for aggregate function groupConcat, should be 0, 1 or 2, got: 5. (TOO_MANY_ARGUMENTS_FOR_FUNCTION)
```
or
```
DB::Exception: Aggregate function groupConcat requires single argument. (NUMBER_OF_ARGUMENTS_DOESNT_MATCH)
```

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.