mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-14 03:25:15 +00:00
35 lines
1.0 KiB
C++
35 lines
1.0 KiB
C++
#pragma once
|
|
|
|
#include <DB/DataStreams/IBlockOutputStream.h>
|
|
#include <DB/DataStreams/IRowOutputStream.h>
|
|
|
|
|
|
namespace DB
|
|
{
|
|
|
|
/** Преобразует поток для записи данных по строкам в поток для записи данных по блокам.
|
|
* Наример, для записи текстового дампа.
|
|
*/
|
|
class BlockOutputStreamFromRowOutputStream : public IBlockOutputStream
|
|
{
|
|
public:
|
|
BlockOutputStreamFromRowOutputStream(RowOutputStreamPtr row_output_);
|
|
void write(const Block & block) override;
|
|
void writePrefix() override { row_output->writePrefix(); }
|
|
void writeSuffix() override { row_output->writeSuffix(); }
|
|
|
|
void flush() override { row_output->flush(); }
|
|
|
|
void setRowsBeforeLimit(size_t rows_before_limit) override;
|
|
void setTotals(const Block & totals) override;
|
|
void setExtremes(const Block & extremes) override;
|
|
|
|
String getContentType() const override { return row_output->getContentType(); }
|
|
|
|
private:
|
|
RowOutputStreamPtr row_output;
|
|
bool first_row;
|
|
};
|
|
|
|
}
|