Updated tests #2094

This commit is contained in:
Alexey Milovidov 2018-08-05 08:25:37 +03:00
parent cf2df6d780
commit 47554229c0
9 changed files with 21 additions and 71 deletions

View File

@ -154,8 +154,9 @@ InterpreterSelectWithUnionQuery::InterpreterSelectWithUnionQuery(
}
}
/// Subquery cannot have ambiguous column names. It is still Ok for top SELECT.
if (subquery_depth > 0 && result_header.hasAmbiguousNames())
/// Subquery cannot have ambiguous column names. It is still Ok for top SELECT. It is still Ok for INSERT SELECT.
/// NOTE MySQL doesn't allow ambiguous column names but PostgreSQL do.
if (subquery_depth > 0 && !required_result_column_names.empty() && result_header.hasAmbiguousNames())
throw Exception("Subquery cannot have duplicate column names", ErrorCodes::DUPLICATE_COLUMN);
}

View File

@ -3,9 +3,9 @@ drop table if exists test.summing_merge_tree_null;
---- partition merge
create table test.summing_merge_tree_aggregate_function (
d Date,
k UInt64,
u AggregateFunction(uniq, UInt64)
d Date,
k UInt64,
u AggregateFunction(uniq, UInt64)
) engine=SummingMergeTree(d, k, 1);
insert into test.summing_merge_tree_aggregate_function
@ -30,11 +30,11 @@ drop table test.summing_merge_tree_aggregate_function;
---- sum + uniq + uniqExact
create table test.summing_merge_tree_aggregate_function (
d materialized today(),
k UInt64,
c UInt64,
u AggregateFunction(uniq, UInt8),
ue AggregateFunction(uniqExact, UInt8)
d materialized today(),
k UInt64,
c UInt64,
u AggregateFunction(uniq, UInt8),
ue AggregateFunction(uniqExact, UInt8)
) engine=SummingMergeTree(d, k, 8192);
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);
select
k, sum(c),
uniqMerge(u), uniqExactMerge(ue)
k, sum(c),
uniqMerge(u), uniqExactMerge(ue)
from test.summing_merge_tree_aggregate_function group by k;
optimize table test.summing_merge_tree_aggregate_function;
select
k, sum(c),
uniqMerge(u), uniqExactMerge(ue)
k, sum(c),
uniqMerge(u), uniqExactMerge(ue)
from test.summing_merge_tree_aggregate_function group by k;
drop table test.summing_merge_tree_aggregate_function;
@ -122,10 +122,10 @@ create table test.summing_merge_tree_null (
) engine=Null;
create materialized view test.summing_merge_tree_aggregate_function (
d materialized today(),
k UInt64,
c UInt64,
u AggregateFunction(uniq, UInt64)
d materialized today(),
k UInt64,
c UInt64,
u AggregateFunction(uniq, UInt64)
) engine=SummingMergeTree(d, k, 8192)
as select d, k, sum(c) as c, uniqState(u) as u
from test.summing_merge_tree_null

View File

@ -1,9 +0,0 @@
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;

View File

@ -1,12 +0,0 @@
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

View File

@ -1,12 +0,0 @@
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;

View File

@ -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]), arrayJoin([2, 3]));
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));
SELECT a, b FROM (SELECT a, *, arrayJoin(c) FROM (SELECT 1 AS a, 2 AS b, [3, 4] AS c));
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, *, arrayJoin(c) FROM (SELECT 1 AS a, 2 AS b, [3, 4] AS c)); -- { serverError 15 }

View File

@ -1,8 +0,0 @@
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

View File

@ -1,7 +0,0 @@
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;