From 5d0957e669e3e7e11c409dae4ec4e65eab1c860e Mon Sep 17 00:00:00 2001 From: xinhuitian Date: Tue, 19 Apr 2022 13:26:33 +0800 Subject: [PATCH] move down data range construction in filterMarksUsingIndex and filterMarksUsingMergedIndex --- .../MergeTree/MergeTreeDataSelectExecutor.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/Storages/MergeTree/MergeTreeDataSelectExecutor.cpp b/src/Storages/MergeTree/MergeTreeDataSelectExecutor.cpp index a6c78d3107d..25fd3dea753 100644 --- a/src/Storages/MergeTree/MergeTreeDataSelectExecutor.cpp +++ b/src/Storages/MergeTree/MergeTreeDataSelectExecutor.cpp @@ -1576,16 +1576,16 @@ MarkRanges MergeTreeDataSelectExecutor::filterMarksUsingIndex( if (index_mark != index_range.begin || !granule || last_index_mark != index_range.begin) granule = reader.read(); - MarkRange data_range( - std::max(ranges[i].begin, index_mark * index_granularity), - std::min(ranges[i].end, (index_mark + 1) * index_granularity)); - if (!condition->mayBeTrueOnGranule(granule)) { ++granules_dropped; continue; } + MarkRange data_range( + std::max(ranges[i].begin, index_mark * index_granularity), + std::min(ranges[i].end, (index_mark + 1) * index_granularity)); + if (res.empty() || res.back().end - data_range.begin > min_marks_for_seek) res.push_back(data_range); else @@ -1676,16 +1676,16 @@ MarkRanges MergeTreeDataSelectExecutor::filterMarksUsingMergedIndex( } } - MarkRange data_range( - std::max(range.begin, index_mark * index_granularity), - std::min(range.end, (index_mark + 1) * index_granularity)); - if (!condition->mayBeTrueOnGranule(granules)) { ++granules_dropped; continue; } + MarkRange data_range( + std::max(range.begin, index_mark * index_granularity), + std::min(range.end, (index_mark + 1) * index_granularity)); + if (res.empty() || res.back().end - data_range.begin > min_marks_for_seek) res.push_back(data_range); else