mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-09-20 08:40:50 +00:00
Added test.
This commit is contained in:
parent
c72b0a45bc
commit
b662b02f8c
@ -0,0 +1,7 @@
|
||||
1 1
|
||||
|
||||
0 2
|
||||
-
|
||||
test1 10 0
|
||||
|
||||
30 70
|
34
tests/queries/0_stateless/01272_totals_and_filter_bug.sql
Normal file
34
tests/queries/0_stateless/01272_totals_and_filter_bug.sql
Normal file
@ -0,0 +1,34 @@
|
||||
select * from (select number, count() from numbers(2) group by number with totals) where number > 0 settings enable_optimize_predicate_expression=0;
|
||||
|
||||
select '-';
|
||||
|
||||
CREATE TABLE foo (server_date Date, dimension_1 String, metric_1 UInt32) ENGINE = MergeTree() PARTITION BY toYYYYMM(server_date) ORDER BY (server_date);
|
||||
CREATE TABLE bar (server_date Date, dimension_1 String, metric_2 UInt32) ENGINE = MergeTree() PARTITION BY toYYYYMM(server_date) ORDER BY (server_date);
|
||||
|
||||
INSERT INTO foo VALUES ('2020-01-01', 'test1', 10), ('2020-01-01', 'test2', 20);
|
||||
INSERT INTO bar VALUES ('2020-01-01', 'test2', 30), ('2020-01-01', 'test3', 40);
|
||||
|
||||
SELECT
|
||||
dimension_1,
|
||||
sum_metric_1,
|
||||
sum_metric_2
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
dimension_1,
|
||||
sum(metric_1) AS sum_metric_1
|
||||
FROM foo
|
||||
GROUP BY dimension_1
|
||||
WITH TOTALS
|
||||
) AS subquery_1
|
||||
ALL FULL OUTER JOIN
|
||||
(
|
||||
SELECT
|
||||
dimension_1,
|
||||
sum(metric_2) AS sum_metric_2
|
||||
FROM bar
|
||||
GROUP BY dimension_1
|
||||
WITH TOTALS
|
||||
) AS subquery_2 USING (dimension_1)
|
||||
WHERE sum_metric_2 < 20
|
||||
ORDER BY dimension_1 ASC;
|
Loading…
Reference in New Issue
Block a user