ClickHouse/src/Processors/ISink.cpp

40 lines
583 B
C++
Raw Normal View History

#include <Processors/ISink.h>
namespace DB
{
ISink::ISink(Block header)
: IProcessor({std::move(header)}, {}), input(inputs.front())
{
}
ISink::Status ISink::prepare()
{
2019-02-07 18:51:53 +00:00
if (has_input)
return Status::Ready;
if (input.isFinished())
{
onFinish();
return Status::Finished;
}
input.setNeeded();
2019-02-07 18:51:53 +00:00
if (!input.hasData())
return Status::NeedData;
2020-10-14 12:51:38 +00:00
current_chunk = input.pull(true);
2019-02-07 18:51:53 +00:00
has_input = true;
return Status::Ready;
}
void ISink::work()
{
consume(std::move(current_chunk));
2019-02-08 16:10:57 +00:00
has_input = false;
}
}