ClickHouse/dbms/include/DB/DataStreams/MaterializingBlockOutputStream.h

39 lines
1.2 KiB
C++
Raw Normal View History

#pragma once
#include <DB/Core/Block.h>
#include <DB/DataStreams/IBlockOutputStream.h>
namespace DB
{
/** Преобразует столбцы-константы в полноценные столбцы ("материализует" их).
*/
class MaterializingBlockOutputStream : public IBlockOutputStream
{
public:
2015-01-27 00:52:03 +00:00
MaterializingBlockOutputStream(const BlockOutputStreamPtr & output)
: output{output} {}
2016-02-25 02:37:31 +00:00
void write(const Block & block) override
{
output->write(materialize(block));
2016-02-25 02:37:31 +00:00
}
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(materialize(totals)); }
void setExtremes(const Block & extremes) override { output->setExtremes(materialize(extremes)); }
void onProgress(const Progress & progress) override { output->onProgress(progress); }
2016-02-25 02:37:31 +00:00
String getContentType() const override { return output->getContentType(); }
private:
BlockOutputStreamPtr output;
static Block materialize(const Block & original_block);
};
}