mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-10 01:25:21 +00:00
Merge pull request #41189 from kssenii/fix-positional-args
Fix for positional arguments
This commit is contained in:
commit
94d6e9ce7d
@ -1258,9 +1258,6 @@ TreeRewriterResultPtr TreeRewriter::analyzeSelect(
|
||||
all_source_columns_set.insert(name);
|
||||
}
|
||||
|
||||
normalize(query, result.aliases, all_source_columns_set, select_options.ignore_alias, settings, /* allow_self_aliases = */ true, getContext());
|
||||
|
||||
|
||||
if (getContext()->getSettingsRef().enable_positional_arguments)
|
||||
{
|
||||
if (select_query->groupBy())
|
||||
@ -1280,6 +1277,8 @@ TreeRewriterResultPtr TreeRewriter::analyzeSelect(
|
||||
}
|
||||
}
|
||||
|
||||
normalize(query, result.aliases, all_source_columns_set, select_options.ignore_alias, settings, /* allow_self_aliases = */ true, getContext());
|
||||
|
||||
/// Remove unneeded columns according to 'required_result_columns'.
|
||||
/// Leave all selected columns in case of DISTINCT; columns that contain arrayJoin function inside.
|
||||
/// Must be after 'normalizeTree' (after expanding aliases, for aliases not get lost)
|
||||
|
@ -117,7 +117,19 @@ select b from (select 5 as a, 'Hello' as b group by a);
|
||||
Hello
|
||||
select b from (select 5 as a, 'Hello' as b order by 1);
|
||||
Hello
|
||||
drop table if exists tp2;
|
||||
create table tp2(first_col String, second_col Int32) engine = MergeTree() order by tuple();
|
||||
select count(*) from (select first_col, count(second_col) from tp2 group by 1);
|
||||
0
|
||||
select total from (select first_col, count(second_col) as total from tp2 group by 1);
|
||||
drop table if exists test;
|
||||
create table test
|
||||
(
|
||||
`id` UInt32,
|
||||
`time` UInt32,
|
||||
index `id` (`id`) type set(0) granularity 3,
|
||||
index `time` (`time`) type minmax granularity 3
|
||||
) engine = MergeTree()
|
||||
order by (`time`);
|
||||
select count(*) as `value`, 0 as `data` from test group by `data`;
|
||||
drop table test;
|
||||
|
@ -49,6 +49,21 @@ select b from (select 5 as a, 'Hello' as b order by a);
|
||||
select b from (select 5 as a, 'Hello' as b group by a);
|
||||
select b from (select 5 as a, 'Hello' as b order by 1);
|
||||
|
||||
drop table if exists tp2;
|
||||
create table tp2(first_col String, second_col Int32) engine = MergeTree() order by tuple();
|
||||
select count(*) from (select first_col, count(second_col) from tp2 group by 1);
|
||||
select total from (select first_col, count(second_col) as total from tp2 group by 1);
|
||||
|
||||
drop table if exists test;
|
||||
create table test
|
||||
(
|
||||
`id` UInt32,
|
||||
`time` UInt32,
|
||||
index `id` (`id`) type set(0) granularity 3,
|
||||
index `time` (`time`) type minmax granularity 3
|
||||
) engine = MergeTree()
|
||||
order by (`time`);
|
||||
|
||||
select count(*) as `value`, 0 as `data` from test group by `data`;
|
||||
|
||||
drop table test;
|
||||
|
Loading…
Reference in New Issue
Block a user