mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-12 01:12:12 +00:00
97f2a2213e
* Move some code outside dbms/src folder * Fix paths
40 lines
924 B
C++
40 lines
924 B
C++
#pragma once
|
|
|
|
#include <DataStreams/IBlockOutputStream.h>
|
|
#include <DataStreams/SquashingTransform.h>
|
|
|
|
|
|
namespace DB
|
|
{
|
|
|
|
/** Merging consecutive blocks of stream to specified minimum size.
|
|
*/
|
|
class SquashingBlockOutputStream : public IBlockOutputStream
|
|
{
|
|
public:
|
|
SquashingBlockOutputStream(BlockOutputStreamPtr dst, Block header_, size_t min_block_size_rows, size_t min_block_size_bytes);
|
|
|
|
Block getHeader() const override { return header; }
|
|
void write(const Block & block) override;
|
|
|
|
void flush() override;
|
|
void writePrefix() override;
|
|
void writeSuffix() override;
|
|
|
|
/// Don't write blocks less than specified size even when flush method was called by user.
|
|
void disableFlush() { disable_flush = true; }
|
|
|
|
private:
|
|
BlockOutputStreamPtr output;
|
|
Block header;
|
|
|
|
SquashingTransform transform;
|
|
bool all_written = false;
|
|
|
|
void finalize();
|
|
|
|
bool disable_flush = false;
|
|
};
|
|
|
|
}
|