From 871ac3eeb783e8e6e6123076768a83937d11e871 Mon Sep 17 00:00:00 2001 From: Nikolai Kochetov Date: Wed, 13 Jan 2021 21:37:54 +0300 Subject: [PATCH] Update building sets. --- src/Interpreters/ExpressionAnalyzer.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/Interpreters/ExpressionAnalyzer.cpp b/src/Interpreters/ExpressionAnalyzer.cpp index ae1aa1a0bb1..42311abd9bf 100644 --- a/src/Interpreters/ExpressionAnalyzer.cpp +++ b/src/Interpreters/ExpressionAnalyzer.cpp @@ -53,6 +53,8 @@ #include #include +#include + namespace DB { @@ -318,13 +320,14 @@ void SelectQueryExpressionAnalyzer::tryMakeSetForIndexFromSubquery(const ASTPtr } auto interpreter_subquery = interpretSubquery(subquery_or_table_name, context, {}, query_options); - auto stream = interpreter_subquery->execute().getInputStream(); + auto io = interpreter_subquery->execute(); + PullingPipelineExecutor executor(io.pipeline); SetPtr set = std::make_shared(settings.size_limits_for_set, true, context.getSettingsRef().transform_null_in); - set->setHeader(stream->getHeader()); + set->setHeader(executor.getHeader()); - stream->readPrefix(); - while (Block block = stream->read()) + Block block; + while (executor.pull(block)) { /// If the limits have been exceeded, give up and let the default subquery processing actions take place. if (!set->insertFromBlock(block)) @@ -332,7 +335,6 @@ void SelectQueryExpressionAnalyzer::tryMakeSetForIndexFromSubquery(const ASTPtr } set->finishInsert(); - stream->readSuffix(); prepared_sets[set_key] = std::move(set); }