ClickHouse/src/Processors/NullSink.h

36 lines
772 B
C++
Raw Normal View History

2019-03-26 18:28:37 +00:00
#pragma once
2019-07-07 14:57:50 +00:00
#include <Processors/IProcessor.h>
2020-04-08 12:40:04 +00:00
#include <Processors/ISink.h>
2019-03-26 18:28:37 +00:00
namespace DB
{
2020-04-09 10:35:51 +00:00
/// Sink which closes input port and reads nothing.
2019-07-07 14:57:50 +00:00
class NullSink : public IProcessor
2019-03-26 18:28:37 +00:00
{
public:
2019-07-07 14:57:50 +00:00
explicit NullSink(Block header) : IProcessor({std::move(header)}, {}) {}
2019-03-26 18:28:37 +00:00
String getName() const override { return "NullSink"; }
2019-07-07 14:57:50 +00:00
Status prepare() override
{
inputs.front().close();
return Status::Finished;
}
InputPort & getPort() { return inputs.front(); }
2019-03-26 18:28:37 +00:00
};
2020-04-09 10:35:51 +00:00
/// Sink which reads everything and do nothing with it.
2020-04-08 12:40:04 +00:00
class EmptySink : public ISink
{
public:
explicit EmptySink(Block header) : ISink(std::move(header)) {}
String getName() const override { return "EmptySink"; }
protected:
void consume(Chunk) override {}
};
2019-03-26 18:28:37 +00:00
}