Fix finalize chain logic in ExpressionAnalysisResult (#10302)

This commit is contained in:
Artem Zuikov 2020-04-16 21:03:27 +03:00 committed by GitHub
parent 15dc45b9b2
commit ce372f464b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 38 additions and 3 deletions

View File

@ -963,13 +963,15 @@ ExpressionAnalysisResult::ExpressionAnalysisResult(
auto finalize_chain = [&](ExpressionActionsChain & chain)
{
chain.finalize();
if (!finalized)
{
chain.finalize();
finalize(chain, context, where_step_num);
chain.clear();
finalized = true;
}
finalized = true;
chain.clear();
};
{

View File

@ -0,0 +1,9 @@
1 0
1 1
2 0
2 1
1 0
1 1
2 0
2 1
200000

View File

@ -0,0 +1,24 @@
SELECT arrayJoin(arrayMap(i -> (i + 1), range(2))) AS index, number
FROM numbers(2)
GROUP BY number
ORDER BY index, number;
SET max_bytes_before_external_group_by = 1;
SELECT arrayJoin(arrayMap(i -> (i + 1), range(2))) AS index, number
FROM numbers(2)
GROUP BY number
ORDER BY index, number;
SET group_by_two_level_threshold = 2;
SELECT count() FROM
(
SELECT
arrayJoin(arrayMap(i -> (i + 1), range(2))) AS index,
number
FROM numbers_mt(100000)
GROUP BY number
ORDER BY index ASC
SETTINGS max_block_size = 100000, max_threads = 2
);