diff --git a/dbms/src/Interpreters/InterpreterSelectQuery.cpp b/dbms/src/Interpreters/InterpreterSelectQuery.cpp index e191c1a49b3..c248340dd82 100644 --- a/dbms/src/Interpreters/InterpreterSelectQuery.cpp +++ b/dbms/src/Interpreters/InterpreterSelectQuery.cpp @@ -438,6 +438,12 @@ void InterpreterSelectQuery::executeImpl(Pipeline & pipeline, const BlockInputSt { pipeline.streams.emplace_back(std::make_shared(source_header)); expressions = analyzeExpressions(QueryProcessingStage::FetchColumns, true); + + if (expressions.prewhere_info) + pipeline.streams.back() = std::make_shared( + pipeline.streams.back(), expressions.prewhere_info->prewhere_actions, + expressions.prewhere_info->prewhere_column_name, expressions.prewhere_info->remove_prewhere_column + ); } else {