mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 15:12:02 +00:00
fix cross alliasing case with JOIN ON
This commit is contained in:
parent
06076e67a3
commit
554e4ab5b8
@ -110,6 +110,9 @@ private:
|
||||
|
||||
static const ASTIdentifier * unrollAliases(const ASTIdentifier * identifier, const Aliases & aliases)
|
||||
{
|
||||
if (identifier->compound())
|
||||
return identifier;
|
||||
|
||||
UInt32 max_attempts = 100;
|
||||
for (auto it = aliases.find(identifier->name); it != aliases.end();)
|
||||
{
|
||||
|
@ -12,6 +12,12 @@ y y
|
||||
y y
|
||||
y y
|
||||
y y
|
||||
2 2
|
||||
2 2
|
||||
2 2
|
||||
2 2
|
||||
2 2
|
||||
2 2
|
||||
2 y 2 w
|
||||
2 y 2 w
|
||||
2 2
|
||||
@ -26,3 +32,9 @@ y y
|
||||
y y
|
||||
y y
|
||||
y y
|
||||
2 2
|
||||
2 2
|
||||
2 2
|
||||
2 2
|
||||
2 2
|
||||
2 2
|
||||
|
@ -10,6 +10,7 @@ insert into t1 values (1, 'x'), (2, 'y'), (3, 'z');
|
||||
insert into t2 values (2, 'w'), (4, 'y');
|
||||
|
||||
set enable_optimize_predicate_expression = 0;
|
||||
|
||||
select * from t1 join t2 on a = c;
|
||||
select * from t1 join t2 on c = a;
|
||||
|
||||
@ -28,14 +29,13 @@ select b as a, d as c from t1 join t2 on c = a;
|
||||
select b as c, d as a from t1 join t2 on a = c;
|
||||
select b as c, d as a from t1 join t2 on c = a;
|
||||
|
||||
-- TODO
|
||||
-- select t1.a as a, t2.c as c from t1 join t2 on a = c;
|
||||
-- select t1.a as a, t2.c as c from t1 join t2 on c = a;
|
||||
-- select t1.a as c, t2.c as a from t1 join t2 on a = c;
|
||||
-- select t1.a as c, t2.c as a from t1 join t2 on c = a;
|
||||
--
|
||||
-- select t1.a as c, t2.c as a from t1 join t2 on t1.a = t2.c;
|
||||
-- select t1.a as c, t2.c as a from t1 join t2 on t2.c = t1.a;
|
||||
select t1.a as a, t2.c as c from t1 join t2 on a = c;
|
||||
select t1.a as a, t2.c as c from t1 join t2 on c = a;
|
||||
select t1.a as c, t2.c as a from t1 join t2 on a = c;
|
||||
select t1.a as c, t2.c as a from t1 join t2 on c = a;
|
||||
|
||||
select t1.a as c, t2.c as a from t1 join t2 on t1.a = t2.c;
|
||||
select t1.a as c, t2.c as a from t1 join t2 on t2.c = t1.a;
|
||||
|
||||
set enable_optimize_predicate_expression = 1;
|
||||
|
||||
@ -57,5 +57,13 @@ select b as a, d as c from t1 join t2 on c = a;
|
||||
select b as c, d as a from t1 join t2 on a = c;
|
||||
select b as c, d as a from t1 join t2 on c = a;
|
||||
|
||||
select t1.a as a, t2.c as c from t1 join t2 on a = c;
|
||||
select t1.a as a, t2.c as c from t1 join t2 on c = a;
|
||||
select t1.a as c, t2.c as a from t1 join t2 on a = c;
|
||||
select t1.a as c, t2.c as a from t1 join t2 on c = a;
|
||||
|
||||
select t1.a as c, t2.c as a from t1 join t2 on t1.a = t2.c;
|
||||
select t1.a as c, t2.c as a from t1 join t2 on t2.c = t1.a;
|
||||
|
||||
drop table t1;
|
||||
drop table t2;
|
||||
|
Loading…
Reference in New Issue
Block a user