Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/Interpreters/Set.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -761,7 +761,17 @@ BoolMask MergeTreeSetIndex::checkInRange(const std::vector<Range> & key_ranges,
}) - indices.begin();

if (begin > end)
{
/// TODO: Remove the #ifndef and always throw after
/// https://github.com/ClickHouse/ClickHouse/issues/90461 is fixed.
/// (What happens here is: the applyMonotonicFunctionsChainToRange call above applies
/// nonmonotonic functions, and we end up with left > right.)
#ifndef NDEBUG
throw Exception(ErrorCodes::LOGICAL_ERROR, "Invalid binary search result in MergeTreeSetIndex");
#else
return {true, true};
#endif
}

bool can_be_true = begin < end;

Expand Down
12 changes: 9 additions & 3 deletions src/Storages/MergeTree/MergeTreeDataSelectExecutor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1715,11 +1715,17 @@ MarkRanges MergeTreeDataSelectExecutor::markRangesFromPKRange(
if (check_in_range(result_exact_range, BoolMask::consider_only_can_be_false).can_be_false)
{
/// key_condition.matchesExactContinuousRange returned true, but the
/// range doesn't seem to be continuous.
/// range doesn't seem to be continuous. Something's broken.
/// TODO: Remove the #ifndef and always throw after
/// https://github.com/ClickHouse/ClickHouse/issues/90461 is fixed.
#ifndef NDEBUG
throw Exception(ErrorCodes::LOGICAL_ERROR, "Inconsistent KeyCondition behavior");
#endif
}
else
{
exact_ranges->emplace_back(std::move(result_exact_range));
}

exact_ranges->emplace_back(std::move(result_exact_range));
}
}
}
Expand Down
Loading