Trying to do such request:
SELECT avgArray([NULL, 1]);
Getting such exception:
Received exception from server (version 18.10.3):
Code: 43. DB::Exception: Received from clickhouse-server:9000, 172.17.0.2. DB::Exception: Illegal type Nullable(UInt8) of argument for aggregate function avg.
ClickHouse server version is 18.10.3.
https://clickhouse.yandex/docs/en/query_language/agg_functions/reference/#avgx
NULL is not number.
It should work.
milovidov-Pro-P30 :) SELECT avg(x) FROM (SELECT arrayJoin([1, NULL]) AS x)
SELECT avg(x)
FROM
(
SELECT arrayJoin([1, NULL]) AS x
)
┌─avg(x)─┐
│ 1 │
└────────┘
1 rows in set. Elapsed: 0.047 sec.
milovidov-Pro-P30 :) SELECT avgArray(x) FROM (SELECT [1, NULL] AS x)
SELECT avgArray(x)
FROM
(
SELECT [1, NULL] AS x
)
Received exception from server (version 18.12.1):
Code: 43. DB::Exception: Received from localhost:9000, 127.0.0.1. DB::Exception: Illegal type Nullable(UInt8) of argument for aggregate function avg.
0 rows in set. Elapsed: 0.141 sec.
Most helpful comment
It should work.