Update some tests.

This commit is contained in:
Nikolai Kochetov 2021-10-19 11:11:54 +03:00
parent 34d46245c3
commit 254eecf227
7 changed files with 72 additions and 98 deletions

View File

@ -6,9 +6,7 @@ ORDER BY timestamp ASC
LIMIT 10 LIMIT 10
Expression (Projection) Expression (Projection)
Limit (preliminary LIMIT (without OFFSET)) Limit (preliminary LIMIT (without OFFSET))
MergingSorted (Merge sorted streams for ORDER BY) Sorting (Sorting for ORDER BY)
MergeSorting (Merge sorted blocks for ORDER BY)
PartialSorting (Sort each block for ORDER BY)
Expression (Before ORDER BY) Expression (Before ORDER BY)
SettingQuotaAndLimits (Set limits and quota after reading from storage) SettingQuotaAndLimits (Set limits and quota after reading from storage)
ReadFromMergeTree ReadFromMergeTree
@ -20,7 +18,7 @@ ORDER BY toDate(timestamp) ASC
LIMIT 10 LIMIT 10
Expression (Projection) Expression (Projection)
Limit (preliminary LIMIT (without OFFSET)) Limit (preliminary LIMIT (without OFFSET))
FinishSorting Sorting
Expression (Before ORDER BY) Expression (Before ORDER BY)
SettingQuotaAndLimits (Set limits and quota after reading from storage) SettingQuotaAndLimits (Set limits and quota after reading from storage)
ReadFromMergeTree ReadFromMergeTree
@ -34,7 +32,7 @@ ORDER BY
LIMIT 10 LIMIT 10
Expression (Projection) Expression (Projection)
Limit (preliminary LIMIT (without OFFSET)) Limit (preliminary LIMIT (without OFFSET))
FinishSorting Sorting
Expression (Before ORDER BY) Expression (Before ORDER BY)
SettingQuotaAndLimits (Set limits and quota after reading from storage) SettingQuotaAndLimits (Set limits and quota after reading from storage)
ReadFromMergeTree ReadFromMergeTree

View File

@ -23,21 +23,19 @@ lambda
optimize_read_in_order optimize_read_in_order
Expression (Projection) Expression (Projection)
Limit (preliminary LIMIT (without OFFSET)) Limit (preliminary LIMIT (without OFFSET))
MergingSorted (Merge sorted streams for ORDER BY) Sorting (Sorting for ORDER BY)
MergeSorting (Merge sorted blocks for ORDER BY)
PartialSorting (Sort each block for ORDER BY)
Expression (Before ORDER BY) Expression (Before ORDER BY)
SettingQuotaAndLimits (Set limits and quota after reading from storage) SettingQuotaAndLimits (Set limits and quota after reading from storage)
ReadFromMergeTree ReadFromMergeTree
Expression (Projection) Expression (Projection)
Limit (preliminary LIMIT (without OFFSET)) Limit (preliminary LIMIT (without OFFSET))
FinishSorting Sorting
Expression (Before ORDER BY) Expression (Before ORDER BY)
SettingQuotaAndLimits (Set limits and quota after reading from storage) SettingQuotaAndLimits (Set limits and quota after reading from storage)
ReadFromMergeTree ReadFromMergeTree
Expression (Projection) Expression (Projection)
Limit (preliminary LIMIT (without OFFSET)) Limit (preliminary LIMIT (without OFFSET))
FinishSorting Sorting
Expression (Before ORDER BY) Expression (Before ORDER BY)
SettingQuotaAndLimits (Set limits and quota after reading from storage) SettingQuotaAndLimits (Set limits and quota after reading from storage)
ReadFromMergeTree ReadFromMergeTree

View File

@ -908,9 +908,7 @@ Expression ((Projection + Before ORDER BY))
Window (Window step for window \'\') Window (Window step for window \'\')
Window (Window step for window \'PARTITION BY p\') Window (Window step for window \'PARTITION BY p\')
Window (Window step for window \'PARTITION BY p ORDER BY o ASC\') Window (Window step for window \'PARTITION BY p ORDER BY o ASC\')
MergingSorted (Merge sorted streams for window \'PARTITION BY p ORDER BY o ASC\') Sorting (Sorting for window \'PARTITION BY p ORDER BY o ASC\')
MergeSorting (Merge sorted blocks for window \'PARTITION BY p ORDER BY o ASC\')
PartialSorting (Sort each block for window \'PARTITION BY p ORDER BY o ASC\')
Expression ((Before window functions + (Projection + Before ORDER BY))) Expression ((Before window functions + (Projection + Before ORDER BY)))
SettingQuotaAndLimits (Set limits and quota after reading from storage) SettingQuotaAndLimits (Set limits and quota after reading from storage)
ReadFromStorage (SystemNumbers) ReadFromStorage (SystemNumbers)
@ -923,13 +921,9 @@ from
; ;
Expression ((Projection + Before ORDER BY)) Expression ((Projection + Before ORDER BY))
Window (Window step for window \'ORDER BY o ASC, number ASC\') Window (Window step for window \'ORDER BY o ASC, number ASC\')
MergingSorted (Merge sorted streams for window \'ORDER BY o ASC, number ASC\') Sorting (Sorting for window \'ORDER BY o ASC, number ASC\')
MergeSorting (Merge sorted blocks for window \'ORDER BY o ASC, number ASC\')
PartialSorting (Sort each block for window \'ORDER BY o ASC, number ASC\')
Window (Window step for window \'ORDER BY number ASC\') Window (Window step for window \'ORDER BY number ASC\')
MergingSorted (Merge sorted streams for window \'ORDER BY number ASC\') Sorting (Sorting for window \'ORDER BY number ASC\')
MergeSorting (Merge sorted blocks for window \'ORDER BY number ASC\')
PartialSorting (Sort each block for window \'ORDER BY number ASC\')
Expression ((Before window functions + (Projection + Before ORDER BY))) Expression ((Before window functions + (Projection + Before ORDER BY)))
SettingQuotaAndLimits (Set limits and quota after reading from storage) SettingQuotaAndLimits (Set limits and quota after reading from storage)
ReadFromStorage (SystemNumbers) ReadFromStorage (SystemNumbers)

View File

@ -5,11 +5,8 @@ FUNCTION sipHash64
Filter column: equals Filter column: equals
> sorting steps should know about limit > sorting steps should know about limit
Limit 10 Limit 10
MergingSorted Sorting
Limit 10 Sorting
MergeSorting
Limit 10
PartialSorting
Limit 10 Limit 10
-- filter push down -- -- filter push down --
> filter should be pushed down after aggregating > filter should be pushed down after aggregating
@ -108,9 +105,8 @@ Filter column: notEquals(y, 2)
1 0 1 0
1 1 1 1
> filter is pushed down before sorting steps > filter is pushed down before sorting steps
MergingSorted Sorting
MergeSorting Sorting
PartialSorting
Filter column: and(notEquals(x, 0), notEquals(y, 0)) Filter column: and(notEquals(x, 0), notEquals(y, 0))
1 2 1 2
1 1 1 1

View File

@ -10,7 +10,7 @@ $CLICKHOUSE_CLIENT -q "select x + 1 from (select y + 2 as x from (select dummy +
echo "> sipHash should be calculated after filtration" echo "> sipHash should be calculated after filtration"
$CLICKHOUSE_CLIENT -q "explain actions = 1 select sum(x), sum(y) from (select sipHash64(number) as x, bitAnd(number, 1024) as y from numbers_mt(1000000000) limit 1000000000) where y = 0" | grep -o "FUNCTION sipHash64\|Filter column: equals" $CLICKHOUSE_CLIENT -q "explain actions = 1 select sum(x), sum(y) from (select sipHash64(number) as x, bitAnd(number, 1024) as y from numbers_mt(1000000000) limit 1000000000) where y = 0" | grep -o "FUNCTION sipHash64\|Filter column: equals"
echo "> sorting steps should know about limit" echo "> sorting steps should know about limit"
$CLICKHOUSE_CLIENT -q "explain actions = 1 select number from (select number from numbers(500000000) order by -number) limit 10" | grep -o "MergingSorted\|MergeSorting\|PartialSorting\|Limit 10" $CLICKHOUSE_CLIENT -q "explain actions = 1 select number from (select number from numbers(500000000) order by -number) limit 10" | grep -o "Sorting\|Limit 10"
echo "-- filter push down --" echo "-- filter push down --"
echo "> filter should be pushed down after aggregating" echo "> filter should be pushed down after aggregating"
@ -132,7 +132,7 @@ $CLICKHOUSE_CLIENT -q "
select number % 2 as x, number % 3 as y from numbers(6) order by y desc select number % 2 as x, number % 3 as y from numbers(6) order by y desc
) where x != 0 and y != 0 ) where x != 0 and y != 0
settings enable_optimize_predicate_expression = 0" | settings enable_optimize_predicate_expression = 0" |
grep -o "MergingSorted\|MergeSorting\|PartialSorting\|Filter column: and(notEquals(x, 0), notEquals(y, 0))" grep -o "Sorting\|Filter column: and(notEquals(x, 0), notEquals(y, 0))"
$CLICKHOUSE_CLIENT -q " $CLICKHOUSE_CLIENT -q "
select x, y from ( select x, y from (
select number % 2 as x, number % 3 as y from numbers(6) order by y desc select number % 2 as x, number % 3 as y from numbers(6) order by y desc

View File

@ -2,12 +2,10 @@
explain select * from remote('127.{1,2}', view(select * from numbers(1e6))) order by number limit 10 settings distributed_push_down_limit=0; explain select * from remote('127.{1,2}', view(select * from numbers(1e6))) order by number limit 10 settings distributed_push_down_limit=0;
Expression (Projection) Expression (Projection)
Limit (preliminary LIMIT (without OFFSET)) Limit (preliminary LIMIT (without OFFSET))
MergingSorted (Merge sorted streams after aggregation stage for ORDER BY) Sorting (Merge sorted streams after aggregation stage for ORDER BY)
SettingQuotaAndLimits (Set limits and quota after reading from storage) SettingQuotaAndLimits (Set limits and quota after reading from storage)
Union Union
MergingSorted (Merge sorted streams for ORDER BY) Sorting (Sorting for ORDER BY)
MergeSorting (Merge sorted blocks for ORDER BY)
PartialSorting (Sort each block for ORDER BY)
Expression (Before ORDER BY) Expression (Before ORDER BY)
SettingQuotaAndLimits (Set limits and quota after reading from storage) SettingQuotaAndLimits (Set limits and quota after reading from storage)
Expression ((Convert VIEW subquery result to VIEW table structure + (Materialize constants after VIEW subquery + (Projection + Before ORDER BY)))) Expression ((Convert VIEW subquery result to VIEW table structure + (Materialize constants after VIEW subquery + (Projection + Before ORDER BY))))
@ -17,13 +15,11 @@ Expression (Projection)
explain select * from remote('127.{1,2}', view(select * from numbers(1e6))) order by number limit 10 settings distributed_push_down_limit=1; explain select * from remote('127.{1,2}', view(select * from numbers(1e6))) order by number limit 10 settings distributed_push_down_limit=1;
Expression (Projection) Expression (Projection)
Limit (preliminary LIMIT (without OFFSET)) Limit (preliminary LIMIT (without OFFSET))
MergingSorted (Merge sorted streams after aggregation stage for ORDER BY) Sorting (Merge sorted streams after aggregation stage for ORDER BY)
SettingQuotaAndLimits (Set limits and quota after reading from storage) SettingQuotaAndLimits (Set limits and quota after reading from storage)
Union Union
Limit (preliminary LIMIT (with OFFSET)) Limit (preliminary LIMIT (with OFFSET))
MergingSorted (Merge sorted streams for ORDER BY) Sorting (Sorting for ORDER BY)
MergeSorting (Merge sorted blocks for ORDER BY)
PartialSorting (Sort each block for ORDER BY)
Expression (Before ORDER BY) Expression (Before ORDER BY)
SettingQuotaAndLimits (Set limits and quota after reading from storage) SettingQuotaAndLimits (Set limits and quota after reading from storage)
Expression ((Convert VIEW subquery result to VIEW table structure + (Materialize constants after VIEW subquery + (Projection + Before ORDER BY)))) Expression ((Convert VIEW subquery result to VIEW table structure + (Materialize constants after VIEW subquery + (Projection + Before ORDER BY))))

View File

@ -50,12 +50,10 @@ SettingQuotaAndLimits (Set limits and quota after reading from storage)
explain select distinct k1 from remote('127.{1,2}', view(select 1 k1, 2 k2, 3 v from numbers(2)), cityHash64(k1, k2)) order by v; -- not optimized explain select distinct k1 from remote('127.{1,2}', view(select 1 k1, 2 k2, 3 v from numbers(2)), cityHash64(k1, k2)) order by v; -- not optimized
Expression (Projection) Expression (Projection)
Distinct Distinct
MergingSorted (Merge sorted streams for ORDER BY, without aggregation) Sorting (Merge sorted streams for ORDER BY, without aggregation)
SettingQuotaAndLimits (Set limits and quota after reading from storage) SettingQuotaAndLimits (Set limits and quota after reading from storage)
Union Union
MergingSorted (Merge sorted streams for ORDER BY) Sorting (Sorting for ORDER BY)
MergeSorting (Merge sorted blocks for ORDER BY)
PartialSorting (Sort each block for ORDER BY)
Distinct (Preliminary DISTINCT) Distinct (Preliminary DISTINCT)
Expression (Before ORDER BY) Expression (Before ORDER BY)
SettingQuotaAndLimits (Set limits and quota after reading from storage) SettingQuotaAndLimits (Set limits and quota after reading from storage)
@ -65,13 +63,11 @@ Expression (Projection)
ReadFromRemote (Read from remote replica) ReadFromRemote (Read from remote replica)
explain select distinct k1, k2 from remote('127.{1,2}', view(select 1 k1, 2 k2, 3 v from numbers(2)), cityHash64(k1, k2)) order by v; -- optimized explain select distinct k1, k2 from remote('127.{1,2}', view(select 1 k1, 2 k2, 3 v from numbers(2)), cityHash64(k1, k2)) order by v; -- optimized
Expression (Projection) Expression (Projection)
MergingSorted (Merge sorted streams after aggregation stage for ORDER BY) Sorting (Merge sorted streams after aggregation stage for ORDER BY)
SettingQuotaAndLimits (Set limits and quota after reading from storage) SettingQuotaAndLimits (Set limits and quota after reading from storage)
Union Union
Distinct Distinct
MergingSorted (Merge sorted streams for ORDER BY) Sorting (Sorting for ORDER BY)
MergeSorting (Merge sorted blocks for ORDER BY)
PartialSorting (Sort each block for ORDER BY)
Distinct (Preliminary DISTINCT) Distinct (Preliminary DISTINCT)
Expression (Before ORDER BY) Expression (Before ORDER BY)
SettingQuotaAndLimits (Set limits and quota after reading from storage) SettingQuotaAndLimits (Set limits and quota after reading from storage)
@ -83,14 +79,12 @@ explain select distinct on (k1) k2 from remote('127.{1,2}', view(select 1 k1, 2
Expression (Projection) Expression (Projection)
LimitBy LimitBy
Expression (Before LIMIT BY) Expression (Before LIMIT BY)
MergingSorted (Merge sorted streams for ORDER BY, without aggregation) Sorting (Merge sorted streams for ORDER BY, without aggregation)
SettingQuotaAndLimits (Set limits and quota after reading from storage) SettingQuotaAndLimits (Set limits and quota after reading from storage)
Union Union
LimitBy LimitBy
Expression (Before LIMIT BY) Expression (Before LIMIT BY)
MergingSorted (Merge sorted streams for ORDER BY) Sorting (Sorting for ORDER BY)
MergeSorting (Merge sorted blocks for ORDER BY)
PartialSorting (Sort each block for ORDER BY)
Expression (Before ORDER BY) Expression (Before ORDER BY)
SettingQuotaAndLimits (Set limits and quota after reading from storage) SettingQuotaAndLimits (Set limits and quota after reading from storage)
Expression ((Convert VIEW subquery result to VIEW table structure + (Materialize constants after VIEW subquery + (Projection + Before ORDER BY)))) Expression ((Convert VIEW subquery result to VIEW table structure + (Materialize constants after VIEW subquery + (Projection + Before ORDER BY))))
@ -99,14 +93,12 @@ Expression (Projection)
ReadFromRemote (Read from remote replica) ReadFromRemote (Read from remote replica)
explain select distinct on (k1, k2) v from remote('127.{1,2}', view(select 1 k1, 2 k2, 3 v from numbers(2)), cityHash64(k1, k2)) order by v; -- optimized explain select distinct on (k1, k2) v from remote('127.{1,2}', view(select 1 k1, 2 k2, 3 v from numbers(2)), cityHash64(k1, k2)) order by v; -- optimized
Expression (Projection) Expression (Projection)
MergingSorted (Merge sorted streams after aggregation stage for ORDER BY) Sorting (Merge sorted streams after aggregation stage for ORDER BY)
SettingQuotaAndLimits (Set limits and quota after reading from storage) SettingQuotaAndLimits (Set limits and quota after reading from storage)
Union Union
LimitBy LimitBy
Expression (Before LIMIT BY) Expression (Before LIMIT BY)
MergingSorted (Merge sorted streams for ORDER BY) Sorting (Sorting for ORDER BY)
MergeSorting (Merge sorted blocks for ORDER BY)
PartialSorting (Sort each block for ORDER BY)
Expression (Before ORDER BY) Expression (Before ORDER BY)
SettingQuotaAndLimits (Set limits and quota after reading from storage) SettingQuotaAndLimits (Set limits and quota after reading from storage)
Expression ((Convert VIEW subquery result to VIEW table structure + (Materialize constants after VIEW subquery + (Projection + Before ORDER BY)))) Expression ((Convert VIEW subquery result to VIEW table structure + (Materialize constants after VIEW subquery + (Projection + Before ORDER BY))))