Exposing 'RangeReader read N rows, but M expected' error#74472
Closed
devcrafter wants to merge 2 commits intomasterfrom
Closed
Exposing 'RangeReader read N rows, but M expected' error#74472devcrafter wants to merge 2 commits intomasterfrom
devcrafter wants to merge 2 commits intomasterfrom
Conversation
22 tasks
Contributor
|
This is an automated comment for commit c0055e1 with description of existing statuses. It's updated for the latest CI running ❌ Click here to open a full report in a separate page
|
7 tasks
Member
|
Thanks for the investigation and the test. I added your test in the PR with a fix: #75270. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related to #62741 #56640
The issue is happened to parts with constant index granularity and triggered by having
PREWHEREin the query.So, having a MergeTree table with
index_granularity_bytes = 0, index_granularity = 42settings and1row, and reading it, will trigger the following error:RangeReader read 1 rows, but 42 expectedTechnically,
MergeTreeIndexGranularityInfo::fixed_index_granularityClickHouse/src/Storages/MergeTree/MergeTreeIndexGranularityInfo.h
Lines 41 to 42 in 39a25b1
is used to initialize
MergeTreeIndexGranularityConstant::last_mark_granularity(it's42in our example)Which in turn used to get the number of rows in the part range (one only in our example, i.e. last as well) in
MergeTreeIndexGranularityConstant::getRowsCountInRange()ClickHouse/src/Storages/MergeTree/MergeTreeIndexGranularityConstant.cpp
Line 99 in 39a25b1
Which will return not a number of rows in the granule but its granularity
CC @CurtizJ, fill free to use this PR for the fix if applicable
Changelog category (leave one):
CI Settings (Only check the boxes if you know what you are doing)
All builds in Builds_1 and Builds_2 stages are always mandatory
and will run independently of the checks below: