2018-05-23 20:19:33 +00:00
|
|
|
#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)
|
2018-05-23 20:19:33 +00:00
|
|
|
return Status::Ready;
|
|
|
|
|
|
|
|
if (input.isFinished())
|
|
|
|
return Status::Finished;
|
|
|
|
|
|
|
|
input.setNeeded();
|
2019-02-07 18:51:53 +00:00
|
|
|
if (!input.hasData())
|
|
|
|
return Status::NeedData;
|
|
|
|
|
2019-02-18 16:36:07 +00:00
|
|
|
current_chunk = input.pull();
|
2019-02-07 18:51:53 +00:00
|
|
|
has_input = true;
|
|
|
|
return Status::Ready;
|
2018-05-23 20:19:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void ISink::work()
|
|
|
|
{
|
2019-02-18 16:36:07 +00:00
|
|
|
consume(std::move(current_chunk));
|
2019-02-08 16:10:57 +00:00
|
|
|
has_input = false;
|
2018-05-23 20:19:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|