mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-10 09:32:06 +00:00
parent
d99ef95846
commit
b9914d6bcd
@ -3,9 +3,9 @@ drop table if exists test.summing_merge_tree_null;
|
|||||||
|
|
||||||
---- partition merge
|
---- partition merge
|
||||||
create table test.summing_merge_tree_aggregate_function (
|
create table test.summing_merge_tree_aggregate_function (
|
||||||
d Date,
|
d Date,
|
||||||
k UInt64,
|
k UInt64,
|
||||||
u AggregateFunction(uniq, UInt64)
|
u AggregateFunction(uniq, UInt64)
|
||||||
) engine=SummingMergeTree(d, k, 1);
|
) engine=SummingMergeTree(d, k, 1);
|
||||||
|
|
||||||
insert into test.summing_merge_tree_aggregate_function
|
insert into test.summing_merge_tree_aggregate_function
|
||||||
@ -30,11 +30,11 @@ drop table test.summing_merge_tree_aggregate_function;
|
|||||||
|
|
||||||
---- sum + uniq + uniqExact
|
---- sum + uniq + uniqExact
|
||||||
create table test.summing_merge_tree_aggregate_function (
|
create table test.summing_merge_tree_aggregate_function (
|
||||||
d materialized today(),
|
d materialized today(),
|
||||||
k UInt64,
|
k UInt64,
|
||||||
c UInt64,
|
c UInt64,
|
||||||
u AggregateFunction(uniq, UInt8),
|
u AggregateFunction(uniq, UInt8),
|
||||||
ue AggregateFunction(uniqExact, UInt8)
|
ue AggregateFunction(uniqExact, UInt8)
|
||||||
) engine=SummingMergeTree(d, k, 8192);
|
) engine=SummingMergeTree(d, k, 8192);
|
||||||
|
|
||||||
insert into test.summing_merge_tree_aggregate_function select 1, 1, uniqState(1), uniqExactState(1);
|
insert into test.summing_merge_tree_aggregate_function select 1, 1, uniqState(1), uniqExactState(1);
|
||||||
@ -45,15 +45,15 @@ insert into test.summing_merge_tree_aggregate_function select 1, 1, uniqState(2)
|
|||||||
insert into test.summing_merge_tree_aggregate_function select 1, 1, uniqState(3), uniqExactState(3);
|
insert into test.summing_merge_tree_aggregate_function select 1, 1, uniqState(3), uniqExactState(3);
|
||||||
|
|
||||||
select
|
select
|
||||||
k, sum(c),
|
k, sum(c),
|
||||||
uniqMerge(u), uniqExactMerge(ue)
|
uniqMerge(u), uniqExactMerge(ue)
|
||||||
from test.summing_merge_tree_aggregate_function group by k;
|
from test.summing_merge_tree_aggregate_function group by k;
|
||||||
|
|
||||||
optimize table test.summing_merge_tree_aggregate_function;
|
optimize table test.summing_merge_tree_aggregate_function;
|
||||||
|
|
||||||
select
|
select
|
||||||
k, sum(c),
|
k, sum(c),
|
||||||
uniqMerge(u), uniqExactMerge(ue)
|
uniqMerge(u), uniqExactMerge(ue)
|
||||||
from test.summing_merge_tree_aggregate_function group by k;
|
from test.summing_merge_tree_aggregate_function group by k;
|
||||||
|
|
||||||
drop table test.summing_merge_tree_aggregate_function;
|
drop table test.summing_merge_tree_aggregate_function;
|
||||||
@ -122,10 +122,10 @@ create table test.summing_merge_tree_null (
|
|||||||
) engine=Null;
|
) engine=Null;
|
||||||
|
|
||||||
create materialized view test.summing_merge_tree_aggregate_function (
|
create materialized view test.summing_merge_tree_aggregate_function (
|
||||||
d materialized today(),
|
d materialized today(),
|
||||||
k UInt64,
|
k UInt64,
|
||||||
c UInt64,
|
c UInt64,
|
||||||
u AggregateFunction(uniq, UInt64)
|
u AggregateFunction(uniq, UInt64)
|
||||||
) engine=SummingMergeTree(d, k, 8192)
|
) engine=SummingMergeTree(d, k, 8192)
|
||||||
as select d, k, sum(c) as c, uniqState(u) as u
|
as select d, k, sum(c) as c, uniqState(u) as u
|
||||||
from test.summing_merge_tree_null
|
from test.summing_merge_tree_null
|
||||||
|
@ -0,0 +1,3 @@
|
|||||||
|
0
|
||||||
|
2
|
||||||
|
42 1 1 0 0
|
@ -0,0 +1,9 @@
|
|||||||
|
select b from (select 1 as a, 42 as c) any left join (select 2 as b, 2 as b, 41 as c) using c;
|
||||||
|
select b from (select 1 as a, 42 as c) any left join (select 2 as b, 2 as b, 42 as c) using c;
|
||||||
|
|
||||||
|
select c,a,a,b,b from
|
||||||
|
(select 1 as a, 1 as a, 42 as c group by c order by a,c)
|
||||||
|
any left join
|
||||||
|
(select 2 as b, 2 as b, 41 as c group by c order by b,c)
|
||||||
|
using c
|
||||||
|
order by b;
|
@ -0,0 +1,12 @@
|
|||||||
|
1 2
|
||||||
|
1 1
|
||||||
|
1
|
||||||
|
1 2
|
||||||
|
1 1 1
|
||||||
|
1 1
|
||||||
|
1 1
|
||||||
|
1 1
|
||||||
|
42 1 2
|
||||||
|
42 1 2
|
||||||
|
0 hello world
|
||||||
|
1 hello world
|
@ -0,0 +1,12 @@
|
|||||||
|
select x, y from (select 1 as x, 2 as y, x, y);
|
||||||
|
select x, y from (select 1 as x, 1 as y, x, y);
|
||||||
|
select x from (select 1 as x, 1 as y, x, y);
|
||||||
|
select * from (select 1 as x, 2 as y, x, y);
|
||||||
|
select * from (select 1 as a, 1 as b, 1 as c, b, c);
|
||||||
|
select b, c from (select 1 as a, 1 as b, 1 as c, b, c);
|
||||||
|
select b, c from (select 1 as a, 1 as b, 1 as c, b, c) any left join (select 1 as a) using a;
|
||||||
|
select b, c from (select 1 as a, 1 as b, 1 as c, 1 as b, 1 as c) any left join (select 1 as a) using a;
|
||||||
|
select a, b, c from (select 42 as a, 1 as b, 2 as c, 1 as b, 2 as c) any left join (select 42 as a, 3 as d) using a;
|
||||||
|
select a, b, c from (select 42 as a, 1 as b, 2 as c, 1 as b, 2 as c) any left join (select 42 as a, 3 as d) using a order by d;
|
||||||
|
|
||||||
|
SELECT k, a1, b1, a2, b2 FROM (SELECT 0 AS k, 'hello' AS a1, 'world' AS b1, a1) ANY FULL OUTER JOIN (SELECT 1 AS k, 'hello' AS a2, 'world' AS b2, a2) USING (k) ORDER BY k;
|
@ -2,5 +2,5 @@ SELECT a FROM (SELECT 1 AS a, 2 AS b);
|
|||||||
SELECT a FROM (SELECT 1 AS a, arrayJoin([2, 3]) AS b);
|
SELECT a FROM (SELECT 1 AS a, arrayJoin([2, 3]) AS b);
|
||||||
SELECT a FROM (SELECT 1 AS a, arrayJoin([2, 3]), arrayJoin([2, 3]));
|
SELECT a FROM (SELECT 1 AS a, arrayJoin([2, 3]), arrayJoin([2, 3]));
|
||||||
SELECT a FROM (SELECT 1 AS a, arrayJoin([2, 3]), arrayJoin([4, 5]));
|
SELECT a FROM (SELECT 1 AS a, arrayJoin([2, 3]), arrayJoin([4, 5]));
|
||||||
SELECT a, b FROM (SELECT a, * FROM (SELECT 1 AS a, 2 AS b, 3 AS c)); -- { serverError 15 }
|
SELECT a, b FROM (SELECT a, * FROM (SELECT 1 AS a, 2 AS b, 3 AS c));
|
||||||
SELECT a, b FROM (SELECT a, *, arrayJoin(c) FROM (SELECT 1 AS a, 2 AS b, [3, 4] AS c)); -- { serverError 15 }
|
SELECT a, b FROM (SELECT a, *, arrayJoin(c) FROM (SELECT 1 AS a, 2 AS b, [3, 4] AS c));
|
||||||
|
@ -0,0 +1,8 @@
|
|||||||
|
0 hello 123 0
|
||||||
|
1 0 hello 456
|
||||||
|
0 hello 123
|
||||||
|
1 0
|
||||||
|
0 hello 123 \N \N
|
||||||
|
1 \N \N hello 456
|
||||||
|
0 hello 123
|
||||||
|
1 \N \N
|
@ -0,0 +1,7 @@
|
|||||||
|
SELECT k, a1, b1, a2, b2 FROM (SELECT 0 AS k, 'hello' AS a1, 123 AS b1, a1) ANY FULL OUTER JOIN (SELECT 1 AS k, 'hello' AS a2, 456 AS b2, a2) USING (k) ORDER BY k;
|
||||||
|
SELECT k, a, b FROM (SELECT 0 AS k, 'hello' AS a, 123 AS b, a) ANY FULL OUTER JOIN (SELECT 1 AS k) USING (k) ORDER BY k;
|
||||||
|
|
||||||
|
SET join_use_nulls = 1;
|
||||||
|
|
||||||
|
SELECT k, a1, b1, a2, b2 FROM (SELECT 0 AS k, 'hello' AS a1, 123 AS b1, a1) ANY FULL OUTER JOIN (SELECT 1 AS k, 'hello' AS a2, 456 AS b2, a2) USING (k) ORDER BY k;
|
||||||
|
SELECT k, a, b FROM (SELECT 0 AS k, 'hello' AS a, 123 AS b, a) ANY FULL OUTER JOIN (SELECT 1 AS k) USING (k) ORDER BY k;
|
Loading…
Reference in New Issue
Block a user