2014-10-13 14:35:40 +00:00
|
|
|
#pragma once
|
|
|
|
|
2017-11-01 03:09:06 +00:00
|
|
|
#include <DataStreams/materializeBlock.h>
|
2017-04-01 09:19:00 +00:00
|
|
|
#include <DataStreams/IBlockOutputStream.h>
|
2017-01-21 04:24:28 +00:00
|
|
|
|
2014-10-13 14:35:40 +00:00
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
2017-05-13 22:19:04 +00:00
|
|
|
/** Converts columns-constants to full columns ("materializes" them).
|
2014-10-13 14:35:40 +00:00
|
|
|
*/
|
|
|
|
class MaterializingBlockOutputStream : public IBlockOutputStream
|
|
|
|
{
|
|
|
|
public:
|
2018-02-19 00:45:32 +00:00
|
|
|
MaterializingBlockOutputStream(const BlockOutputStreamPtr & output, const Block & header)
|
|
|
|
: output{output}, header(header) {}
|
2017-04-01 07:20:54 +00:00
|
|
|
|
2018-02-19 00:45:32 +00:00
|
|
|
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:
|
2017-04-01 07:20:54 +00:00
|
|
|
BlockOutputStreamPtr output;
|
2018-02-19 00:45:32 +00:00
|
|
|
Block header;
|
2014-10-13 14:35:40 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|