2016-07-07 01:57:48 +00:00
|
|
|
#pragma once
|
|
|
|
|
2017-04-01 09:19:00 +00:00
|
|
|
#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:
|
2017-04-01 07:20:54 +00:00
|
|
|
SquashingBlockOutputStream(BlockOutputStreamPtr & dst, size_t min_block_size_rows, size_t min_block_size_bytes);
|
2016-07-07 01:57:48 +00:00
|
|
|
|
2017-04-01 07:20:54 +00:00
|
|
|
void write(const Block & block) override;
|
2016-07-07 01:57:48 +00:00
|
|
|
|
2017-04-01 07:20:54 +00:00
|
|
|
void flush() override;
|
|
|
|
void writePrefix() override;
|
|
|
|
void writeSuffix() override;
|
2016-07-07 01:57:48 +00:00
|
|
|
|
|
|
|
private:
|
2017-04-01 07:20:54 +00:00
|
|
|
BlockOutputStreamPtr output;
|
2016-07-07 01:57:48 +00:00
|
|
|
|
2017-04-01 07:20:54 +00:00
|
|
|
SquashingTransform transform;
|
|
|
|
bool all_written = false;
|
2016-07-07 01:57:48 +00:00
|
|
|
|
2017-04-01 07:20:54 +00:00
|
|
|
void finalize();
|
2016-07-07 01:57:48 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|