ClickHouse/dbms/src/DataStreams/SquashingBlockOutputStream.h

33 lines
658 B
C++
Raw Normal View History

2016-07-07 01:57:48 +00:00
#pragma once
#include <DataStreams/IBlockOutputStream.h>
#include <DataStreams/SquashingTransform.h>
2016-07-07 01:57:48 +00:00
namespace DB
{
/** Merging consecutive blocks of stream to specified minimum size.
*/
class SquashingBlockOutputStream : public IBlockOutputStream
{
public:
SquashingBlockOutputStream(BlockOutputStreamPtr & dst, size_t min_block_size_rows, size_t min_block_size_bytes);
2016-07-07 01:57:48 +00:00
void write(const Block & block) override;
2016-07-07 01:57:48 +00:00
void flush() override;
void writePrefix() override;
void writeSuffix() override;
2016-07-07 01:57:48 +00:00
private:
BlockOutputStreamPtr output;
2016-07-07 01:57:48 +00:00
SquashingTransform transform;
bool all_written = false;
2016-07-07 01:57:48 +00:00
void finalize();
2016-07-07 01:57:48 +00:00
};
}