WithMergeableStateAfterAggregation is not a good idea.

This commit is contained in:
Nikolai Kochetov 2024-05-16 16:55:51 +00:00
parent 08bcbfc251
commit 2f6a4e2a4f
2 changed files with 4 additions and 1 deletions

View File

@ -545,7 +545,7 @@ PlannerExpressionsAnalysisResult buildExpressionAnalysisResult(const QueryTreeNo
* otherwise coordinator does not find it in block.
*/
NameSet required_output_nodes_names;
if (sort_analysis_result_optional.has_value() && !planner_query_processing_info.isSecondStage())
if (sort_analysis_result_optional.has_value() && planner_query_processing_info.isFirstStage() && planner_query_processing_info.getToStage() != QueryProcessingStage::Complete)
{
const auto & before_order_by_actions = sort_analysis_result_optional->before_order_by_actions;
for (const auto & output_node : before_order_by_actions->getOutputs())

View File

@ -34,3 +34,6 @@ select * from dist_01757 where dummy in (0, 1) settings optimize_skip_unused_sha
select * from dist_01757 where dummy in (0, 1) settings optimize_skip_unused_shards_limit=9223372036854775808; -- { serverError 69 }
drop table dist_01757;
-- fuzzed
SELECT * FROM remote('127.0.0.{1,2}', numbers(40), number) ORDER BY 'a' LIMIT 1 BY number SETTINGS optimize_skip_unused_shards = 1, force_optimize_skip_unused_shards=0 format Null