ClickHouse/dbms/src/DataStreams/MaterializingBlockOutputStream.h

35 lines
1.4 KiB
C++
Raw Normal View History

#pragma once
2017-11-01 03:09:06 +00:00
#include <DataStreams/materializeBlock.h>
#include <DataStreams/IBlockOutputStream.h>
namespace DB
{
2017-05-13 22:19:04 +00:00
/** Converts columns-constants to full columns ("materializes" them).
*/
class MaterializingBlockOutputStream : public IBlockOutputStream
{
public:
MaterializingBlockOutputStream(const BlockOutputStreamPtr & output, const Block & header)
: output{output}, header(header) {}
Block getHeader() const override { return header; }
2017-11-01 03:09:06 +00:00
void write(const Block & block) override { output->write(materializeBlock(block)); }
void flush() override { output->flush(); }
void writePrefix() override { output->writePrefix(); }
void writeSuffix() override { output->writeSuffix(); }
void setRowsBeforeLimit(size_t rows_before_limit) override { output->setRowsBeforeLimit(rows_before_limit); }
void setTotals(const Block & totals) override { output->setTotals(materializeBlock(totals)); }
void setExtremes(const Block & extremes) override { output->setExtremes(materializeBlock(extremes)); }
void onProgress(const Progress & progress) override { output->onProgress(progress); }
String getContentType() const override { return output->getContentType(); }
2016-02-25 02:37:31 +00:00
private:
BlockOutputStreamPtr output;
Block header;
};
}