ClickHouse/tests/queries/0_stateless/00572_aggregation_by_empty_set.sql
Ivan 97f2a2213e
Move all folders inside /dbms one level up (#9974)
* Move some code outside dbms/src folder
* Fix paths
2020-04-02 02:51:21 +03:00

22 lines
1.1 KiB
SQL

CREATE TEMPORARY TABLE t (x UInt8);
SET empty_result_for_aggregation_by_empty_set = 0;
SELECT count() FROM system.one WHERE 0;
SELECT count() FROM system.one WHERE rand() < 0;
SELECT count() FROM system.one WHERE 1;
SELECT count(), uniq(x), avg(x), avg(toNullable(x)), groupArray(x), groupUniqArray(x) FROM t;
SELECT count(), uniq(x), avg(x), avg(toNullable(x)), groupArray(x), groupUniqArray(x) FROM (SELECT * FROM t UNION ALL SELECT * FROM t);
SELECT x, count(), uniq(x), avg(x), avg(toNullable(x)), groupArray(x), groupUniqArray(x) FROM t GROUP BY x;
SET empty_result_for_aggregation_by_empty_set = 1;
SELECT count() FROM system.one WHERE 0;
SELECT count() FROM system.one WHERE rand() < 0;
SELECT count() FROM system.one WHERE 1;
SELECT count(), uniq(x), avg(x), avg(toNullable(x)), groupArray(x), groupUniqArray(x) FROM t;
SELECT count(), uniq(x), avg(x), avg(toNullable(x)), groupArray(x), groupUniqArray(x) FROM (SELECT * FROM t UNION ALL SELECT * FROM t);
SELECT x, count(), uniq(x), avg(x), avg(toNullable(x)), groupArray(x), groupUniqArray(x) FROM t GROUP BY x;