mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-14 02:12:21 +00:00
40 lines
579 B
C++
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;
|
|
}
|
|
|
|
}
|
|
|