2019-10-16 18:27:53 +00:00
|
|
|
#include <Storages/MergeTree/IMergeTreeDataPartWriter.h>
|
2019-11-27 11:35:27 +00:00
|
|
|
#include <DataStreams/SquashingTransform.h>
|
2019-10-16 18:27:53 +00:00
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
2019-10-22 10:50:17 +00:00
|
|
|
class MergeTreeDataPartWriterCompact : public IMergeTreeDataPartWriter
|
2019-10-16 18:27:53 +00:00
|
|
|
{
|
|
|
|
public:
|
2019-10-22 10:50:17 +00:00
|
|
|
MergeTreeDataPartWriterCompact(
|
|
|
|
const String & part_path,
|
|
|
|
const MergeTreeData & storage,
|
|
|
|
const NamesAndTypesList & columns_list,
|
2019-11-07 11:11:38 +00:00
|
|
|
const std::vector<MergeTreeIndexPtr> & indices_to_recalc,
|
2019-10-22 10:50:17 +00:00
|
|
|
const String & marks_file_extension,
|
|
|
|
const CompressionCodecPtr & default_codec,
|
2019-11-07 11:11:38 +00:00
|
|
|
const WriterSettings & settings,
|
|
|
|
const MergeTreeIndexGranularity & index_granularity);
|
2019-10-22 10:50:17 +00:00
|
|
|
|
2019-12-09 21:21:17 +00:00
|
|
|
void write(const Block & block, const IColumn::Permutation * permutation = nullptr,
|
|
|
|
const Block & primary_key_block = {}, const Block & skip_indexes_block = {}) override;
|
2019-10-16 18:27:53 +00:00
|
|
|
|
2019-11-18 15:18:50 +00:00
|
|
|
void finishDataSerialization(IMergeTreeDataPart::Checksums & checksums, bool sync = false) override;
|
2019-10-21 17:23:06 +00:00
|
|
|
|
|
|
|
private:
|
2019-10-16 18:27:53 +00:00
|
|
|
/// Write single granule of one column (rows between 2 marks)
|
|
|
|
size_t writeColumnSingleGranule(
|
|
|
|
const ColumnWithTypeAndName & column,
|
|
|
|
size_t from_row,
|
|
|
|
size_t number_of_rows);
|
2019-10-21 17:23:06 +00:00
|
|
|
|
2019-11-27 11:35:27 +00:00
|
|
|
void writeBlock(const Block & block);
|
|
|
|
|
2019-10-21 00:28:29 +00:00
|
|
|
ColumnStreamPtr stream;
|
2019-11-27 11:35:27 +00:00
|
|
|
|
|
|
|
SquashingTransform squashing;
|
|
|
|
Block header;
|
2019-10-16 18:27:53 +00:00
|
|
|
};
|
|
|
|
|
2019-10-21 15:33:59 +00:00
|
|
|
}
|