ClickHouse/dbms/Processors/Sources/SinkToOutputStream.cpp
Ivan 97f2a2213e
Move all folders inside /dbms one level up (#9974)
* Move some code outside dbms/src folder
* Fix paths
2020-04-02 02:51:21 +03:00

29 lines
535 B
C++

#include <Processors/Sources/SinkToOutputStream.h>
#include <DataStreams/IBlockOutputStream.h>
namespace DB
{
SinkToOutputStream::SinkToOutputStream(BlockOutputStreamPtr stream_)
: ISink(stream_->getHeader())
, stream(std::move(stream_))
{
}
void SinkToOutputStream::consume(Chunk chunk)
{
if (!initialized)
stream->writePrefix();
initialized = true;
stream->write(getPort().getHeader().cloneWithColumns(chunk.detachColumns()));
}
void SinkToOutputStream::onFinish()
{
stream->writeSuffix();
}
}