mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-14 11:33:46 +00:00
40 lines
583 B
C++
40 lines
583 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(true);
|
|
has_input = true;
|
|
return Status::Ready;
|
|
}
|
|
|
|
void ISink::work()
|
|
{
|
|
consume(std::move(current_chunk));
|
|
has_input = false;
|
|
}
|
|
|
|
}
|
|
|