Force read in order of parts using single thread.

This commit is contained in:
Nikolai Kochetov 2020-03-25 15:10:24 +03:00
parent 93daa16271
commit 4837257bca

View File

@ -61,6 +61,7 @@ namespace std
#include <Processors/Transforms/MergingSortedTransform.h>
#include <Processors/Executors/TreeExecutorBlockInputStream.h>
#include <Processors/Sources/SourceFromInputStream.h>
#include <Processors/ConcatProcessor.h>
namespace ProfileEvents
{
@ -802,6 +803,15 @@ Pipes MergeTreeDataSelectExecutor::spreadMarkRangesAmongStreams(
res.emplace_back(std::move(source));
}
/// Use ConcatProcessor to concat sources together.
/// It is needed to read in parts order (and so in PK order) if single thread is used.
if (res.size() > 1)
{
auto concat = std::make_shared<ConcatProcessor>(res.front().getHeader(), res.size());
Pipe pipe(std::move(res), std::move(concat));
res = { std::move(pipe) };
}
}
return res;