From fa883f2ac390a12ae8b0a7e53bf0b3d715e278c6 Mon Sep 17 00:00:00 2001 From: Anton Popov Date: Fri, 28 Jan 2022 17:23:51 +0300 Subject: [PATCH] fix tests --- src/Interpreters/InterpreterSelectQuery.cpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/Interpreters/InterpreterSelectQuery.cpp b/src/Interpreters/InterpreterSelectQuery.cpp index be29804f602..1885a141d23 100644 --- a/src/Interpreters/InterpreterSelectQuery.cpp +++ b/src/Interpreters/InterpreterSelectQuery.cpp @@ -567,6 +567,9 @@ InterpreterSelectQuery::InterpreterSelectQuery( analysis_result.required_columns = required_columns; } + if (query_info.projection) + storage_snapshot->addProjection(query_info.projection->desc); + /// Blocks used in expression analysis contains size 1 const columns for constant folding and /// null non-const columns to avoid useless memory allocations. However, a valid block sample /// requires all columns to be of size 0, thus we need to sanitize the block here. @@ -614,19 +617,13 @@ Block InterpreterSelectQuery::getSampleBlockImpl() query_info.has_window = query_analyzer->hasWindow(); if (storage && !options.only_analyze) { - from_stage = storage->getQueryProcessingStage(context, options.to_stage, storage_snapshot, query_info); - - if (query_info.projection) - storage_snapshot->addProjection(query_info.projection->desc); - auto & query = getSelectQuery(); query_analyzer->makeSetsForIndex(query.where()); query_analyzer->makeSetsForIndex(query.prewhere()); query_info.sets = query_analyzer->getPreparedSets(); - } - if (storage && !options.only_analyze) from_stage = storage->getQueryProcessingStage(context, options.to_stage, storage_snapshot, query_info); + } /// Do I need to perform the first part of the pipeline? /// Running on remote servers during distributed processing or if query is not distributed.