mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-23 16:12:01 +00:00
Merge pull request #31420 from kssenii/fix-positional-args-bug
Fix group by with positional args
This commit is contained in:
commit
b040890fcf
@ -164,7 +164,7 @@ void optimizeGroupBy(ASTSelectQuery * select_query, ContextPtr context)
|
||||
if (value.getType() == Field::Types::UInt64)
|
||||
{
|
||||
auto pos = value.get<UInt64>();
|
||||
if (pos > 0 && pos <= select_query->children.size())
|
||||
if (pos > 0 && pos <= select_query->select()->children.size())
|
||||
keep_position = true;
|
||||
}
|
||||
}
|
||||
|
@ -145,3 +145,6 @@ select x1, x1 * 2, max(x2), max(x3) from test2 group by 2, 1, x1 order by 1, 2,
|
||||
1 2 10 100
|
||||
10 20 1 10
|
||||
100 200 100 1
|
||||
select a, b, c, d, e, f from (select 44 a, 88 b, 13 c, 14 d, 15 e, 16 f) t group by 1,2,3,4,5,6
|
||||
|
||||
44 88 13 14 15 16
|
||||
|
@ -47,3 +47,5 @@ explain syntax select x1 + x3, x3 from test group by 1, 2;
|
||||
create table test2(x1 Int, x2 Int, x3 Int) engine=Memory;
|
||||
insert into test2 values (1, 10, 100), (10, 1, 10), (100, 100, 1);
|
||||
select x1, x1 * 2, max(x2), max(x3) from test2 group by 2, 1, x1 order by 1, 2, 4 desc, 3 asc;
|
||||
|
||||
select a, b, c, d, e, f from (select 44 a, 88 b, 13 c, 14 d, 15 e, 16 f) t group by 1,2,3,4,5,6
|
||||
|
Loading…
Reference in New Issue
Block a user