From c2396c514462dbe70d53a9c76408539d724feef4 Mon Sep 17 00:00:00 2001 From: Nikolai Kochetov Date: Fri, 23 Apr 2021 17:18:31 +0300 Subject: [PATCH] Disable read-in-order optimization in case of projections. --- src/Interpreters/InterpreterSelectQuery.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Interpreters/InterpreterSelectQuery.cpp b/src/Interpreters/InterpreterSelectQuery.cpp index 4c3ff6bfdcb..aaeabbefc4d 100644 --- a/src/Interpreters/InterpreterSelectQuery.cpp +++ b/src/Interpreters/InterpreterSelectQuery.cpp @@ -1822,7 +1822,7 @@ void InterpreterSelectQuery::executeFetchColumns(QueryProcessingStage::Enum proc /// Create optimizer with prepared actions. /// Maybe we will need to calc input_order_info later, e.g. while reading from StorageMerge. - if (analysis_result.optimize_read_in_order || analysis_result.optimize_aggregation_in_order) + if ((analysis_result.optimize_read_in_order || analysis_result.optimize_aggregation_in_order) && !query_info.aggregate_projection) { if (analysis_result.optimize_read_in_order) query_info.order_optimizer = std::make_shared(