mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-13 19:14:30 +00:00
97f2a2213e
* Move some code outside dbms/src folder * Fix paths
29 lines
535 B
C++
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();
|
|
}
|
|
|
|
}
|