mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-23 08:02:02 +00:00
Respect table alias for additional_table_filters.
This commit is contained in:
parent
c24800c7d5
commit
e6969d5010
@ -297,7 +297,8 @@ static ASTPtr parseAdditionalFilterConditionForTable(
|
|||||||
auto & table = tuple.at(0).safeGet<String>();
|
auto & table = tuple.at(0).safeGet<String>();
|
||||||
auto & filter = tuple.at(1).safeGet<String>();
|
auto & filter = tuple.at(1).safeGet<String>();
|
||||||
|
|
||||||
if ((table == target.table && context.getCurrentDatabase() == target.database) ||
|
if (table == target.alias ||
|
||||||
|
(table == target.table && context.getCurrentDatabase() == target.database) ||
|
||||||
(table == target.database + '.' + target.table))
|
(table == target.database + '.' + target.table))
|
||||||
{
|
{
|
||||||
/// Try to parse expression
|
/// Try to parse expression
|
||||||
|
@ -66,6 +66,12 @@ select * from system.numbers limit 5;
|
|||||||
2
|
2
|
||||||
3
|
3
|
||||||
4
|
4
|
||||||
|
select * from system.numbers as t limit 5 settings additional_table_filters={'t' : 'number % 2 != 0'};
|
||||||
|
1
|
||||||
|
3
|
||||||
|
5
|
||||||
|
7
|
||||||
|
9
|
||||||
select * from system.numbers limit 5 settings additional_table_filters={'system.numbers' : 'number != 3'};
|
select * from system.numbers limit 5 settings additional_table_filters={'system.numbers' : 'number != 3'};
|
||||||
0
|
0
|
||||||
1
|
1
|
||||||
|
@ -30,6 +30,7 @@ select * from remote('127.0.0.{1,2}', system.one) settings additional_table_filt
|
|||||||
select * from remote('127.0.0.{1,2}', system.one) settings additional_table_filters={'system.one' : 'dummy != 0'};
|
select * from remote('127.0.0.{1,2}', system.one) settings additional_table_filters={'system.one' : 'dummy != 0'};
|
||||||
|
|
||||||
select * from system.numbers limit 5;
|
select * from system.numbers limit 5;
|
||||||
|
select * from system.numbers as t limit 5 settings additional_table_filters={'t' : 'number % 2 != 0'};
|
||||||
select * from system.numbers limit 5 settings additional_table_filters={'system.numbers' : 'number != 3'};
|
select * from system.numbers limit 5 settings additional_table_filters={'system.numbers' : 'number != 3'};
|
||||||
select * from system.numbers limit 5 settings additional_table_filters={'system.numbers':'number != 3','table_1':'x!=2'};
|
select * from system.numbers limit 5 settings additional_table_filters={'system.numbers':'number != 3','table_1':'x!=2'};
|
||||||
select * from (select number from system.numbers limit 5 union all select x from table_1) order by number settings additional_table_filters={'system.numbers':'number != 3','table_1':'x!=2'};
|
select * from (select number from system.numbers limit 5 union all select x from table_1) order by number settings additional_table_filters={'system.numbers':'number != 3','table_1':'x!=2'};
|
||||||
|
Loading…
Reference in New Issue
Block a user