mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-10 09:32:06 +00:00
Updated test.
This commit is contained in:
parent
c4c14de02f
commit
064facd8de
@ -125,9 +125,6 @@ void CreatingSetsBlockInputStream::createOne(SubqueryForSet & subquery)
|
|||||||
|
|
||||||
if (!done_with_join)
|
if (!done_with_join)
|
||||||
{
|
{
|
||||||
if (subquery.joined_block_actions)
|
|
||||||
subquery.joined_block_actions->execute(block);
|
|
||||||
|
|
||||||
for (const auto & name_with_alias : subquery.joined_block_aliases)
|
for (const auto & name_with_alias : subquery.joined_block_aliases)
|
||||||
{
|
{
|
||||||
if (block.has(name_with_alias.first))
|
if (block.has(name_with_alias.first))
|
||||||
@ -140,6 +137,9 @@ void CreatingSetsBlockInputStream::createOne(SubqueryForSet & subquery)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (subquery.joined_block_actions)
|
||||||
|
subquery.joined_block_actions->execute(block);
|
||||||
|
|
||||||
if (!subquery.join->insertFromBlock(block))
|
if (!subquery.join->insertFromBlock(block))
|
||||||
done_with_join = true;
|
done_with_join = true;
|
||||||
}
|
}
|
||||||
|
@ -2463,7 +2463,6 @@ bool ExpressionAnalyzer::appendJoin(ExpressionActionsChain & chain, bool only_ty
|
|||||||
subquery_for_set.joined_block_aliases.emplace_back(column.original_name, column.name_and_type.name);
|
subquery_for_set.joined_block_aliases.emplace_back(column.original_name, column.name_and_type.name);
|
||||||
|
|
||||||
auto sample_block = subquery_for_set.source->getHeader();
|
auto sample_block = subquery_for_set.source->getHeader();
|
||||||
analyzed_join.joined_block_actions->execute(sample_block);
|
|
||||||
for (const auto & name_with_alias : subquery_for_set.joined_block_aliases)
|
for (const auto & name_with_alias : subquery_for_set.joined_block_aliases)
|
||||||
{
|
{
|
||||||
if (sample_block.has(name_with_alias.first))
|
if (sample_block.has(name_with_alias.first))
|
||||||
@ -2476,6 +2475,8 @@ bool ExpressionAnalyzer::appendJoin(ExpressionActionsChain & chain, bool only_ty
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
analyzed_join.joined_block_actions->execute(sample_block);
|
||||||
|
|
||||||
/// TODO You do not need to set this up when JOIN is only needed on remote servers.
|
/// TODO You do not need to set this up when JOIN is only needed on remote servers.
|
||||||
subquery_for_set.join = join;
|
subquery_for_set.join = join;
|
||||||
subquery_for_set.join->setSampleBlock(sample_block);
|
subquery_for_set.join->setSampleBlock(sample_block);
|
||||||
|
@ -30,3 +30,4 @@
|
|||||||
1
|
1
|
||||||
-------Push to having expression, need check.-------
|
-------Push to having expression, need check.-------
|
||||||
-------Compatibility test-------
|
-------Compatibility test-------
|
||||||
|
1 2000-01-01 2000-01-01 1 test string 1 1
|
||||||
|
@ -68,7 +68,7 @@ SELECT * FROM (SELECT toUInt64(b), sum(id) AS b FROM test.test) WHERE `toUInt64(
|
|||||||
SELECT * FROM (SELECT toUInt64(table_alias.b) AS a, sum(id) AS b FROM test.test AS table_alias) AS outer_table_alias WHERE outer_table_alias.b = 3; -- { serverError 277 }
|
SELECT * FROM (SELECT toUInt64(table_alias.b) AS a, sum(id) AS b FROM test.test AS table_alias) AS outer_table_alias WHERE outer_table_alias.b = 3; -- { serverError 277 }
|
||||||
|
|
||||||
SELECT '-------Compatibility test-------';
|
SELECT '-------Compatibility test-------';
|
||||||
SELECT * FROM (SELECT 1 AS id, toDate('2000-01-01') AS date FROM system.numbers LIMIT 1) ANY LEFT JOIN (SELECT * FROM test.test) AS b USING date WHERE b.date = toDate('2000-01-01'); -- {serverError 47}
|
SELECT * FROM (SELECT toInt8(1) AS id, toDate('2000-01-01') AS date FROM system.numbers LIMIT 1) ANY LEFT JOIN (SELECT * FROM test.test) AS b USING date, id WHERE b.date = toDate('2000-01-01');
|
||||||
|
|
||||||
DROP TABLE IF EXISTS test.test;
|
DROP TABLE IF EXISTS test.test;
|
||||||
DROP TABLE IF EXISTS test.test_view;
|
DROP TABLE IF EXISTS test.test_view;
|
||||||
|
@ -0,0 +1,3 @@
|
|||||||
|
1 1 1 2
|
||||||
|
1 2 1 2
|
||||||
|
2 3 0 0
|
20
dbms/tests/queries/0_stateless/00725_join_on_bug_1.sql
Normal file
20
dbms/tests/queries/0_stateless/00725_join_on_bug_1.sql
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
create database if not exists test;
|
||||||
|
|
||||||
|
DROP TABLE IF EXISTS test.a1;
|
||||||
|
DROP TABLE IF EXISTS test.a2;
|
||||||
|
|
||||||
|
CREATE TABLE test.a1(a UInt8, b UInt8) ENGINE=Memory;
|
||||||
|
CREATE TABLE test.a2(a UInt8, b UInt8) ENGINE=Memory;
|
||||||
|
|
||||||
|
INSERT INTO test.a1 VALUES (1, 1);
|
||||||
|
INSERT INTO test.a1 VALUES (1, 2);
|
||||||
|
INSERT INTO test.a1 VALUES (2, 3);
|
||||||
|
INSERT INTO test.a2 VALUES (1, 2);
|
||||||
|
INSERT INTO test.a2 VALUES (1, 3);
|
||||||
|
INSERT INTO test.a2 VALUES (1, 4);
|
||||||
|
|
||||||
|
SELECT * FROM test.a1 as a left JOIN test.a2 as b on a.a=b.a ORDER BY b SETTINGS join_default_strictness='ANY';
|
||||||
|
|
||||||
|
DROP TABLE IF EXISTS test.a1;
|
||||||
|
DROP TABLE IF EXISTS test.a2;
|
||||||
|
|
17
dbms/tests/queries/0_stateless/00725_join_on_bug_2.reference
Normal file
17
dbms/tests/queries/0_stateless/00725_join_on_bug_2.reference
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
1 1 1 1
|
||||||
|
2 2 0 0
|
||||||
|
-
|
||||||
|
1 1 1 1
|
||||||
|
2 2 0 0
|
||||||
|
-
|
||||||
|
1 1 1 1
|
||||||
|
2 2 0 0
|
||||||
|
-
|
||||||
|
1 1 1 1
|
||||||
|
2 2 0 0
|
||||||
|
-
|
||||||
|
1 1 1 1
|
||||||
|
2 2 0 0
|
||||||
|
-
|
||||||
|
1 1 1 1
|
||||||
|
2 2 0 0
|
25
dbms/tests/queries/0_stateless/00725_join_on_bug_2.sql
Normal file
25
dbms/tests/queries/0_stateless/00725_join_on_bug_2.sql
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
create database if not exists test;
|
||||||
|
|
||||||
|
drop table if exists test.t;
|
||||||
|
drop table if exists test.s;
|
||||||
|
|
||||||
|
create table test.t(a Int64, b Int64) engine = TinyLog;
|
||||||
|
insert into test.t values(1,1);
|
||||||
|
insert into test.t values(2,2);
|
||||||
|
create table test.s(a Int64, b Int64) engine = TinyLog;
|
||||||
|
insert into test.s values(1,1);
|
||||||
|
|
||||||
|
select a, b, s_a, s_b from test.t all left join (select a,b,a s_a, b s_b from test.s) using (a,b);
|
||||||
|
select '-';
|
||||||
|
select * from test.t all left join test.s using (a,b);
|
||||||
|
select '-';
|
||||||
|
select a,b,s_a,s_b from test.t all left join (select a, b, a s_a, b s_b from test.s) s on (s.a = t.a and s.b = t.b);
|
||||||
|
select '-';
|
||||||
|
select * from test.t all left join (select a s_a, b s_b from test.s) on (s_a = t.a and s_b = t.b);
|
||||||
|
select '-';
|
||||||
|
select a,b,s_a,s_b from test.t all left join (select a,b, a s_a, b s_b from test.s) on (s_a = t.a and s_b = t.b);
|
||||||
|
select '-';
|
||||||
|
select t.*, s.* from test.t all left join test.s on (s.a = t.a and s.b = t.b);
|
||||||
|
|
||||||
|
drop table if exists test.t;
|
||||||
|
drop table if exists test.s;
|
@ -0,0 +1,2 @@
|
|||||||
|
1 1 1 1 1
|
||||||
|
2 2 0 0 0
|
16
dbms/tests/queries/0_stateless/00725_join_on_bug_3.sql
Normal file
16
dbms/tests/queries/0_stateless/00725_join_on_bug_3.sql
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
create database if not exists test;
|
||||||
|
|
||||||
|
drop table if exists test.t;
|
||||||
|
drop table if exists test.z;
|
||||||
|
|
||||||
|
create table test.t(a Int64, b Int64) engine = TinyLog;
|
||||||
|
insert into test.t values(1,1);
|
||||||
|
insert into test.t values(2,2);
|
||||||
|
create table test.z(c Int64, d Int64, e Int64) engine = TinyLog;
|
||||||
|
insert into test.z values(1,1,1);
|
||||||
|
|
||||||
|
select * from test.t all left join test.z on (z.c = t.a and z.d = t.b);
|
||||||
|
|
||||||
|
drop table if exists test.t;
|
||||||
|
drop table if exists test.z;
|
||||||
|
|
@ -0,0 +1 @@
|
|||||||
|
2 2 b
|
15
dbms/tests/queries/0_stateless/00725_join_on_bug_4.sql
Normal file
15
dbms/tests/queries/0_stateless/00725_join_on_bug_4.sql
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
create database if not exists test;
|
||||||
|
|
||||||
|
drop table if exists test.t;
|
||||||
|
drop table if exists test.s;
|
||||||
|
|
||||||
|
create table test.t(a Int64, b Int64, c String) engine = TinyLog;
|
||||||
|
insert into test.t values(1,1,'a'),(2,2,'b');
|
||||||
|
create table test.s(a Int64, b Int64, c String) engine = TinyLog;
|
||||||
|
insert into test.s values(1,1,'a');
|
||||||
|
|
||||||
|
|
||||||
|
select t.* from test.t all left join test.s on (s.a = t.a and s.b = t.b) where s.a = 0 and s.b = 0;
|
||||||
|
|
||||||
|
drop table if exists test.t;
|
||||||
|
drop table if exists test.s;
|
Loading…
Reference in New Issue
Block a user