ClickHouse/tests/queries/0_stateless/02481_analyzer_optimize_aggregation_arithmetics.sql
2023-01-17 11:20:24 +01:00

15 lines
463 B
SQL

SET allow_experimental_analyzer = 1;
SET optimize_arithmetic_operations_in_aggregate_functions = 1;
-- { echoOn }
EXPLAIN QUERY TREE SELECT avg(log(2) * number) FROM numbers(10);
EXPLAIN QUERY TREE SELECT avg(number * log(2)) FROM numbers(10);
SELECT round(avg(log(2) * number), 6) AS k FROM numbers(10000000) GROUP BY number % 3, number % 2;
SELECT round(avg(number * log(2)), 6) AS k FROM numbers(10000000) GROUP BY number % 3, number % 2;
-- { echoOff }