ClickHouse/src/Processors/ISink.cpp
2020-04-03 18:14:31 +03:00

40 lines
579 B
C++

#include <Processors/ISink.h>
namespace DB
{
ISink::ISink(Block header)
: IProcessor({std::move(header)}, {}), input(inputs.front())
{
}
ISink::Status ISink::prepare()
{
if (has_input)
return Status::Ready;
if (input.isFinished())
{
onFinish();
return Status::Finished;
}
input.setNeeded();
if (!input.hasData())
return Status::NeedData;
current_chunk = input.pull();
has_input = true;
return Status::Ready;
}
void ISink::work()
{
consume(std::move(current_chunk));
has_input = false;
}
}