mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-29 11:02:08 +00:00
Call writePrefix() from ctor in SinkToOutputStream
This will fix lack of headers for the following formats if there are zero rows: - TSVWithNames - CSVWithNames - TSVWithNamesAndTypes
This commit is contained in:
parent
e43f49edfb
commit
72205cd326
@ -8,15 +8,11 @@ SinkToOutputStream::SinkToOutputStream(BlockOutputStreamPtr stream_)
|
|||||||
: ISink(stream_->getHeader())
|
: ISink(stream_->getHeader())
|
||||||
, stream(std::move(stream_))
|
, stream(std::move(stream_))
|
||||||
{
|
{
|
||||||
|
stream->writePrefix();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SinkToOutputStream::consume(Chunk chunk)
|
void SinkToOutputStream::consume(Chunk chunk)
|
||||||
{
|
{
|
||||||
if (!initialized)
|
|
||||||
stream->writePrefix();
|
|
||||||
|
|
||||||
initialized = true;
|
|
||||||
|
|
||||||
stream->write(getPort().getHeader().cloneWithColumns(chunk.detachColumns()));
|
stream->write(getPort().getHeader().cloneWithColumns(chunk.detachColumns()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,7 +22,6 @@ protected:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
BlockOutputStreamPtr stream;
|
BlockOutputStreamPtr stream;
|
||||||
bool initialized = false;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user