mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-22 07:31:57 +00:00
97f2a2213e
* Move some code outside dbms/src folder * Fix paths
64 lines
1.1 KiB
C++
64 lines
1.1 KiB
C++
#include <Processors/ConcatProcessor.h>
|
|
|
|
|
|
namespace DB
|
|
{
|
|
|
|
ConcatProcessor::Status ConcatProcessor::prepare()
|
|
{
|
|
auto & output = outputs.front();
|
|
|
|
/// Check can output.
|
|
|
|
if (output.isFinished())
|
|
{
|
|
for (; current_input != inputs.end(); ++current_input)
|
|
current_input->close();
|
|
|
|
return Status::Finished;
|
|
}
|
|
|
|
if (!output.isNeeded())
|
|
{
|
|
if (current_input != inputs.end())
|
|
current_input->setNotNeeded();
|
|
|
|
return Status::PortFull;
|
|
}
|
|
|
|
if (!output.canPush())
|
|
return Status::PortFull;
|
|
|
|
/// Check can input.
|
|
|
|
if (current_input == inputs.end())
|
|
return Status::Finished;
|
|
|
|
if (current_input->isFinished())
|
|
{
|
|
++current_input;
|
|
if (current_input == inputs.end())
|
|
{
|
|
output.finish();
|
|
return Status::Finished;
|
|
}
|
|
}
|
|
|
|
auto & input = *current_input;
|
|
|
|
input.setNeeded();
|
|
|
|
if (!input.hasData())
|
|
return Status::NeedData;
|
|
|
|
/// Move data.
|
|
output.push(input.pull());
|
|
|
|
/// Now, we pushed to output, and it must be full.
|
|
return Status::PortFull;
|
|
}
|
|
|
|
}
|
|
|
|
|