Fix more tests again

This commit is contained in:
Nikolai Kochetov 2021-09-21 09:57:55 +03:00
parent 4e7d5191e3
commit 12a4c74af0
5 changed files with 20 additions and 7 deletions

View File

@ -602,8 +602,6 @@ static void logQueryViews(std::list<ViewRuntimeData> & views, ContextPtr context
try
{
//std::cerr << "============ Logging for " << static_cast<const void *>(view.runtime_stats.thread_status.get()) << ' ' << view.table_id.getNameForLogs() << "\n";
if (view.runtime_stats.thread_status)
view.runtime_stats.thread_status->logToQueryViewsLog(view);
}

View File

@ -217,7 +217,7 @@ BlockIO getDistributedDDLStatus(const String & node_path, const DDLLogEntry & en
io.pipeline = QueryPipeline(std::move(source));
if (context->getSettingsRef().distributed_ddl_output_mode == DistributedDDLOutputMode::NONE)
io.pipeline.complete(Pipe(std::make_shared<EmptySink>(io.pipeline.getHeader())));
io.pipeline.complete(std::make_shared<EmptySink>(io.pipeline.getHeader()));
return io;
}

View File

@ -657,13 +657,13 @@ static std::tuple<ASTPtr, BlockIO> executeQueryImpl(
/// Hold element of process list till end of query execution.
res.process_list_entry = process_list_entry;
if (pipeline.pulling())
if (pipeline.pulling() || pipeline.completed())
{
/// Limits on the result, the quota on the result, and also callback for progress.
/// Limits apply only to the final result.
pipeline.setProgressCallback(context->getProgressCallback());
pipeline.setProcessListElement(context->getProcessListElement());
if (stage == QueryProcessingStage::Complete)
if (stage == QueryProcessingStage::Complete && pipeline.pulling())
pipeline.setLimitsAndQuota(limits, quota);
}
else if (pipeline.pushing())

View File

@ -322,6 +322,19 @@ static void drop(OutputPort *& port, Processors & processors)
QueryPipeline::QueryPipeline(std::shared_ptr<SinkToStorage> sink) : QueryPipeline(Chain(std::move(sink))) {}
void QueryPipeline::complete(std::shared_ptr<ISink> sink)
{
if (!pulling())
throw Exception(ErrorCodes::LOGICAL_ERROR, "Pipeline must be pulling to be completed with chain");
drop(totals, processors);
drop(extremes, processors);
connect(*output, sink->getPort());
processors.emplace_back(std::move(sink));
output = nullptr;
}
void QueryPipeline::complete(Chain chain)
{
if (!pulling())
@ -444,7 +457,7 @@ void QueryPipeline::setProcessListElement(QueryStatus * elem)
{
process_list_element = elem;
if (pulling())
if (pulling() || completed())
{
for (auto & processor : processors)
{
@ -467,7 +480,7 @@ void QueryPipeline::setLimitsAndQuota(const StreamLocalLimits & limits, std::sha
if (!pulling())
throw Exception(
ErrorCodes::LOGICAL_ERROR,
"It is possible to set limits and quota only to pullint QueryPipeline");
"It is possible to set limits and quota only to pulling QueryPipeline");
auto transform = std::make_shared<LimitsCheckingTransform>(output->getHeader(), limits);
transform->setQuota(quota);

View File

@ -25,6 +25,7 @@ class Chain;
class IOutputFormat;
class SinkToStorage;
class ISource;
class ISink;
class QueryPipeline
{
@ -79,6 +80,7 @@ public:
void complete(std::shared_ptr<IOutputFormat> format);
void complete(Chain chain);
void complete(std::shared_ptr<SinkToStorage> sink);
void complete(std::shared_ptr<ISink> sink);
/// Only for pushing and pulling.
Block getHeader() const;