This commit is contained in:
Nikita Vasilev 2019-01-03 19:47:42 +03:00
parent 69052b3fc0
commit 35dbb94312
2 changed files with 28 additions and 5 deletions

View File

@ -620,6 +620,8 @@ MergeTreeData::MutableDataPartPtr MergeTreeDataMergerMutator::mergePartsToTempor
}
ExpressionActionsPtr stream_expr = data.sorting_key_expr;
/// TODO: добавлять стобцы из индексов
for (const auto & part : parts)
{
auto input = std::make_unique<MergeTreeSequentialBlockInputStream>(
@ -628,11 +630,14 @@ MergeTreeData::MutableDataPartPtr MergeTreeDataMergerMutator::mergePartsToTempor
input->setProgressCallback(MergeProgressCallback(
merge_entry, sum_input_rows_upper_bound, column_sizes, watch_prev_elapsed, merge_alg));
if (data.hasPrimaryKey())
src_streams.emplace_back(std::make_shared<MaterializingBlockInputStream>(
std::make_shared<ExpressionBlockInputStream>(BlockInputStreamPtr(std::move(input)), data.sorting_key_expr)));
else
if (data.hasPrimaryKey()) {
auto stream = std::make_shared<MaterializingBlockInputStream>(
std::make_shared<ExpressionBlockInputStream>(
BlockInputStreamPtr(std::move(input)), stream_expr));
src_streams.emplace_back(stream);
} else {
src_streams.emplace_back(std::move(input));
}
}
Names sort_columns = data.sorting_key_columns;

View File

@ -57,8 +57,25 @@ public:
using IndexConditionPtr = std::shared_ptr<IndexCondition>;
struct MergeTreeIndexGranule
{
friend MergeTreeIndexPart;
public:
virtual ~MergeTreeIndexGranule();
virtual void serializeBinary() const = 0;
virtual void deserializeBinary() const = 0;
virtual void update(const Block & block, size_t first, size_t last) = 0;
};
using MergeTreeIndexGranulePtr = std::shared_ptr<MergeTreeIndexGranule>;
/// Data structure for operations with index data for each MergeTreeDataPart.
/// Stores information specific for DataPart.
/// Возможно будет убран.
struct MergeTreeIndexPart
{
friend MergeTreeIndex;
@ -71,10 +88,11 @@ public:
virtual MergeTreeIndexPartPtr cloneEmpty() const = 0;
virtual MergeTreeIndexGranulePtr createIndexGranule() const = 0;
virtual IndexConditionPtr createIndexConditionOnPart(
const SelectQueryInfo & query_info, const Context & context) const = 0;
MergeTreeIndexPtr index; // if parts can migrate to another tables it can be bad
MergeTreeIndexPtr index;
};