2019-06-18 12:54:27 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <Storages/MergeTree/MergeTreeIndexGranularity.h>
|
2019-08-19 10:37:04 +00:00
|
|
|
#include <Storages/MergeTree/MergeTreeIndexGranularityInfo.h>
|
2019-06-18 12:54:27 +00:00
|
|
|
#include <IO/WriteBufferFromFile.h>
|
|
|
|
#include <Compression/CompressedWriteBuffer.h>
|
|
|
|
#include <IO/HashingWriteBuffer.h>
|
|
|
|
#include <Storages/MergeTree/MergeTreeData.h>
|
|
|
|
#include <DataStreams/IBlockOutputStream.h>
|
2019-10-20 23:36:27 +00:00
|
|
|
#include <Storages/MergeTree/IMergeTreeDataPart.h>
|
2019-10-21 15:33:59 +00:00
|
|
|
#include <Storages/MergeTree/IMergeTreeDataPartWriter.h>
|
2019-06-18 12:54:27 +00:00
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
|
|
|
class IMergedBlockOutputStream : public IBlockOutputStream
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
IMergedBlockOutputStream(
|
2019-11-07 11:11:38 +00:00
|
|
|
const MergeTreeDataPartPtr & data_part);
|
2019-06-18 12:54:27 +00:00
|
|
|
|
|
|
|
using WrittenOffsetColumns = std::set<std::string>;
|
|
|
|
|
2019-11-07 11:11:38 +00:00
|
|
|
const MergeTreeIndexGranularity & getIndexGranularity()
|
|
|
|
{
|
|
|
|
return writer->getIndexGranularity();
|
|
|
|
}
|
|
|
|
|
2019-06-18 12:54:27 +00:00
|
|
|
protected:
|
|
|
|
using SerializationState = IDataType::SerializeBinaryBulkStatePtr;
|
|
|
|
using SerializationStates = std::vector<SerializationState>;
|
|
|
|
|
|
|
|
IDataType::OutputStreamGetter createStreamGetter(const String & name, WrittenOffsetColumns & offset_columns, bool skip_offsets);
|
|
|
|
|
|
|
|
protected:
|
2019-10-20 23:36:27 +00:00
|
|
|
const MergeTreeData & storage;
|
2019-06-18 12:54:27 +00:00
|
|
|
|
2019-07-28 11:10:35 +00:00
|
|
|
String part_path;
|
|
|
|
|
2019-06-18 12:54:27 +00:00
|
|
|
/// The offset to the first row of the block for which you want to write the index.
|
2019-11-05 11:53:22 +00:00
|
|
|
// size_t index_offset = 0;
|
2019-06-18 12:54:27 +00:00
|
|
|
|
2019-11-05 11:53:22 +00:00
|
|
|
// size_t current_mark = 0;
|
2019-08-30 14:29:08 +00:00
|
|
|
|
2019-08-30 14:30:28 +00:00
|
|
|
/// Number of mark in data from which skip indices have to start
|
2019-08-30 14:29:08 +00:00
|
|
|
/// aggregation. I.e. it's data mark number, not skip indices mark.
|
2019-11-05 11:53:22 +00:00
|
|
|
// size_t skip_index_data_mark = 0;
|
2019-06-18 12:54:27 +00:00
|
|
|
|
2019-11-05 11:53:22 +00:00
|
|
|
// const bool can_use_adaptive_granularity;
|
|
|
|
// const std::string marks_file_extension;
|
|
|
|
// const bool blocks_are_granules_size;
|
2019-06-18 12:54:27 +00:00
|
|
|
|
2019-11-05 11:53:22 +00:00
|
|
|
// MergeTreeIndexGranularity index_granularity;
|
2019-06-18 12:54:27 +00:00
|
|
|
|
2019-11-05 11:53:22 +00:00
|
|
|
// const bool compute_granularity;
|
2019-06-18 12:54:27 +00:00
|
|
|
|
2019-11-05 11:53:22 +00:00
|
|
|
// std::vector<MergeTreeIndexPtr> skip_indices;
|
|
|
|
// std::vector<std::unique_ptr<IMergeTreeDataPartWriter::ColumnStream>> skip_indices_streams;
|
|
|
|
// MergeTreeIndexAggregators skip_indices_aggregators;
|
|
|
|
// std::vector<size_t> skip_index_filling;
|
2019-07-28 11:10:35 +00:00
|
|
|
|
2019-12-09 21:21:17 +00:00
|
|
|
static Block getBlockAndPermute(const Block & block, const Names & names, const IColumn::Permutation * permutation);
|
|
|
|
|
2019-10-21 15:33:59 +00:00
|
|
|
MergeTreeWriterPtr writer;
|
2019-10-19 16:49:36 +00:00
|
|
|
|
2019-11-07 11:11:38 +00:00
|
|
|
// const bool with_final_mark;
|
2019-06-18 12:54:27 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|