diff --git a/docs/en/operations/settings/settings.md b/docs/en/operations/settings/settings.md index 4c61830b94e..37609939071 100644 --- a/docs/en/operations/settings/settings.md +++ b/docs/en/operations/settings/settings.md @@ -3015,7 +3015,7 @@ Query: ``` sql CREATE TABLE fuse_tbl(a Int8, b Int8) Engine = Log; SET optimize_fuse_sum_count_avg = 1; -EXPLAIN SYNTAX SELECT sum(a), sum(b), count(b) from fuse_tbl FORMAT TSV; +EXPLAIN SYNTAX SELECT sum(a), sum(b), count(b), avg(b) from fuse_tbl FORMAT TSV; ``` Result: @@ -3024,7 +3024,8 @@ Result: SELECT sum(a), sumCount(b).1, - sumCount(b).2 + sumCount(b).2, + (sumCount(b).1) / (sumCount(b).2) FROM fuse_tbl ``` diff --git a/docs/en/sql-reference/aggregate-functions/reference/sumcount.md b/docs/en/sql-reference/aggregate-functions/reference/sumcount.md index 9dd68e7e104..086d8619c5a 100644 --- a/docs/en/sql-reference/aggregate-functions/reference/sumcount.md +++ b/docs/en/sql-reference/aggregate-functions/reference/sumcount.md @@ -14,7 +14,7 @@ sumCount(x) **Returned value** -- Tuple `(sum, count)`, where `sum` is the sum of numbers and `count` is a counts the number of rows or not-NULL values. +- Tuple `(sum, count)`, where `sum` is the sum of numbers and `count` is the number of rows with not-NULL values. Type: [Tuple](../../../sql-reference/data-types/tuple.md). @@ -38,4 +38,4 @@ Result: **See also** -- [optimize_fuse_sum_count_avg](../../../operations/settings/settings.md#optimize_fuse_sum_count_avg) setting. \ No newline at end of file +- [optimize_fuse_sum_count_avg](../../../operations/settings/settings.md#optimize_fuse_sum_count_avg) setting. diff --git a/docs/ru/operations/settings/settings.md b/docs/ru/operations/settings/settings.md index 3a67642cc51..620e38b2f94 100644 --- a/docs/ru/operations/settings/settings.md +++ b/docs/ru/operations/settings/settings.md @@ -2906,7 +2906,7 @@ SELECT * FROM test LIMIT 10 OFFSET 100; ``` sql CREATE TABLE fuse_tbl(a Int8, b Int8) Engine = Log; SET optimize_fuse_sum_count_avg = 1; -EXPLAIN SYNTAX SELECT sum(a), sum(b), count(b) from fuse_tbl FORMAT TSV; +EXPLAIN SYNTAX SELECT sum(a), sum(b), count(b), avg(b) from fuse_tbl FORMAT TSV; ``` Результат: @@ -2915,7 +2915,8 @@ EXPLAIN SYNTAX SELECT sum(a), sum(b), count(b) from fuse_tbl FORMAT TSV; SELECT sum(a), sumCount(b).1, - sumCount(b).2 + sumCount(b).2, + (sumCount(b).1) / (sumCount(b).2) FROM fuse_tbl ``` diff --git a/docs/ru/sql-reference/aggregate-functions/reference/sumcount.md b/docs/ru/sql-reference/aggregate-functions/reference/sumcount.md index d6b9c98f724..b6caf2a94b8 100644 --- a/docs/ru/sql-reference/aggregate-functions/reference/sumcount.md +++ b/docs/ru/sql-reference/aggregate-functions/reference/sumcount.md @@ -18,7 +18,7 @@ sumCount(x) **Возвращаемое значение** -- Кортеж из элементов `(sum, count)`, где `sum` — это сумма чисел и `count` — количество строк или не-нулевых значений. +- Кортеж из элементов `(sum, count)`, где `sum` — это сумма чисел и `count` — количество строк со значениями, отличными от `NULL`. Тип: [Tuple](../../../sql-reference/data-types/tuple.md). @@ -27,8 +27,9 @@ sumCount(x) Запрос: ``` sql -CREATE TABLE test (x Int8) Engine = Log; +CREATE TABLE test (x Nullable(Int8)) Engine = Log; INSERT INTO test SELECT number FROM numbers(1, 20); +INSERT INTO test VALUES (NULL); SELECT sumCount(x) from test; ``` @@ -42,4 +43,4 @@ SELECT sumCount(x) from test; **Смотрите также** -- Настройка [optimize_fuse_sum_count_avg](../../../operations/settings/settings.md#optimize_fuse_sum_count_avg) \ No newline at end of file +- Настройка [optimize_fuse_sum_count_avg](../../../operations/settings/settings.md#optimize_fuse_sum_count_avg)