ClickHouse / ClickHouse/ClickHouse

Misleading exception message when using deltaSumTimestamp with unsupported datatype

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

Description

https://fiddle.clickhouse.com/127e283e-3044-4281-8a1d-bb4be0f3f60d

```sql
CREATE TABLE t1 (val UInt64, timestamp UInt16) ENGINE=MergeTree order by ();

INSERT INTO t1 VALUES (-4,1), (4,2), (8,3), (3,4);

SELECT deltaSumTimestamp(val, timestamp) from t1;
```

head output:
`
Received exception from server (version 24.11.1):
Code: 43. DB::Exception: Received from localhost:9000. DB::Exception: Illegal type UInt64 of argument for aggregate function deltaSumTimestamp, this type is not supported. (ILLEGAL_TYPE_OF_ARGUMENT)
(query: SELECT deltaSumTimestamp(val, timestamp) from t1;)
`

But actually the second argument of type UInt16 has illegal type (https://github.com/ClickHouse/ClickHouse/pull/71790). UInt64 is supported for the first argument of deltaSumTimestamp aggregate function.

If I change timestamp column to a supported datatype UInt32, it will be valid query with first argument of type UInt64.
```sql
CREATE TABLE t1 (val UInt64, timestamp UInt32) ENGINE=MergeTree order by ();

INSERT INTO t1 VALUES (-4,1), (4,2), (8,3), (3,4);

SELECT deltaSumTimestamp(val, timestamp) from t1;
```
```
4
```

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.