From 541c641b2442ff2032d8bc679a73bd6d2dab6ca3 Mon Sep 17 00:00:00 2001 From: Nikita Vasilev Date: Tue, 8 Jan 2019 00:06:08 +0300 Subject: [PATCH] fix --- dbms/src/Storages/MergeTree/MergeTreeIndexes.h | 2 -- dbms/src/Storages/MergeTree/MergeTreeTestIndex.h | 9 +++------ .../Storages/MergeTree/MergedBlockOutputStream.cpp | 12 ++++++------ 3 files changed, 9 insertions(+), 14 deletions(-) diff --git a/dbms/src/Storages/MergeTree/MergeTreeIndexes.h b/dbms/src/Storages/MergeTree/MergeTreeIndexes.h index cc97a82f3dc..239678e1d21 100644 --- a/dbms/src/Storages/MergeTree/MergeTreeIndexes.h +++ b/dbms/src/Storages/MergeTree/MergeTreeIndexes.h @@ -76,8 +76,6 @@ public: virtual IndexConditionPtr createIndexCondition( const SelectQueryInfo & query_info, const Context & context) const = 0; - virtual void writeText(WriteBuffer & ostr) const = 0; - String name; ExpressionActionsPtr expr; size_t granularity; diff --git a/dbms/src/Storages/MergeTree/MergeTreeTestIndex.h b/dbms/src/Storages/MergeTree/MergeTreeTestIndex.h index f1253f8e906..b501df59017 100644 --- a/dbms/src/Storages/MergeTree/MergeTreeTestIndex.h +++ b/dbms/src/Storages/MergeTree/MergeTreeTestIndex.h @@ -28,15 +28,15 @@ struct MergeTreeTestGranule : public MergeTreeIndexGranule { } bool empty() const override { - return static_cast(emp); + return emp == 0; } void update(const Block &block, size_t *pos, size_t limit) override { *pos += std::min(limit, block.rows() - *pos); - emp = rand(); + emp = 10; }; - Int32 emp = true; + Int32 emp = 0; }; class IndexTestCondition : public IndexCondition{ @@ -75,9 +75,6 @@ public: return std::make_shared(); }; - void writeText(WriteBuffer & ostr) const override { - DB::writeText(10, ostr); - }; }; std::unique_ptr MTItestCreator( diff --git a/dbms/src/Storages/MergeTree/MergedBlockOutputStream.cpp b/dbms/src/Storages/MergeTree/MergedBlockOutputStream.cpp index 42d19e6afe8..dad1c8c7a06 100644 --- a/dbms/src/Storages/MergeTree/MergedBlockOutputStream.cpp +++ b/dbms/src/Storages/MergeTree/MergedBlockOutputStream.cpp @@ -548,11 +548,11 @@ void MergedBlockOutputStream::writeImpl(const Block & block, const IColumn::Perm { const auto index = storage.indexes[i]; auto & stream = *skip_indexes_streams[i]; - size_t prev_mark = 0; + size_t prev_pos = 0; - while (prev_mark < rows) { + while (prev_pos < rows) { size_t limit = 0; - if (prev_mark == 0 && index_offset != 0) + if (prev_pos == 0 && index_offset != 0) { limit = index_offset; } @@ -571,10 +571,10 @@ void MergedBlockOutputStream::writeImpl(const Block & block, const IColumn::Perm } } - size_t pos = prev_mark; + size_t pos = prev_pos; skip_indexes_granules[i]->update(block, &pos, limit); - if (pos == prev_mark + limit) { + if (pos == prev_pos + limit) { ++skip_index_filling[i]; /// write index if it is filled @@ -584,7 +584,7 @@ void MergedBlockOutputStream::writeImpl(const Block & block, const IColumn::Perm skip_index_filling[i] = 0; } } - prev_mark = pos; + prev_pos = pos; } } }