mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 15:12:02 +00:00
disable optimize_read_in_order for window functions
This commit is contained in:
parent
1b2ed51ff5
commit
590259a7a5
@ -1511,6 +1511,7 @@ ExpressionAnalysisResult::ExpressionAnalysisResult(
|
||||
settings.optimize_read_in_order
|
||||
&& storage && query.orderBy()
|
||||
&& !query_analyzer.hasAggregation()
|
||||
&& !query_analyzer.hasWindow()
|
||||
&& !query.final()
|
||||
&& join_allow_read_in_order;
|
||||
|
||||
|
@ -920,6 +920,34 @@ FROM numbers(2)
|
||||
;
|
||||
1 0
|
||||
1 1
|
||||
-- optimize_read_in_order conflicts with sorting for window functions, must
|
||||
-- be disabled.
|
||||
create table window_mt engine MergeTree order by number
|
||||
as select number, mod(number, 3) p from numbers(100);
|
||||
select number, count(*) over (partition by p)
|
||||
from window_mt order by number limit 10 settings optimize_read_in_order = 0;
|
||||
0 34
|
||||
1 33
|
||||
2 33
|
||||
3 34
|
||||
4 33
|
||||
5 33
|
||||
6 34
|
||||
7 33
|
||||
8 33
|
||||
9 34
|
||||
select number, count(*) over (partition by p)
|
||||
from window_mt order by number limit 10 settings optimize_read_in_order = 1;
|
||||
0 34
|
||||
1 33
|
||||
2 33
|
||||
3 34
|
||||
4 33
|
||||
5 33
|
||||
6 34
|
||||
7 33
|
||||
8 33
|
||||
9 34
|
||||
-- some true window functions -- rank and friends
|
||||
select number, p, o,
|
||||
count(*) over w,
|
||||
|
@ -316,6 +316,17 @@ SELECT
|
||||
FROM numbers(2)
|
||||
;
|
||||
|
||||
-- optimize_read_in_order conflicts with sorting for window functions, must
|
||||
-- be disabled.
|
||||
create table window_mt engine MergeTree order by number
|
||||
as select number, mod(number, 3) p from numbers(100);
|
||||
|
||||
select number, count(*) over (partition by p)
|
||||
from window_mt order by number limit 10 settings optimize_read_in_order = 0;
|
||||
|
||||
select number, count(*) over (partition by p)
|
||||
from window_mt order by number limit 10 settings optimize_read_in_order = 1;
|
||||
|
||||
-- some true window functions -- rank and friends
|
||||
select number, p, o,
|
||||
count(*) over w,
|
||||
|
Loading…
Reference in New Issue
Block a user