Fix exception when finding minimum size column during merge#95073
Merged
alexey-milovidov merged 3 commits intomasterfrom Jan 25, 2026
Merged
Fix exception when finding minimum size column during merge#95073alexey-milovidov merged 3 commits intomasterfrom
alexey-milovidov merged 3 commits intomasterfrom
Conversation
When no physical columns are needed for reading a part during merge, `injectRequiredColumns` tries to find a minimum size column to determine row count. Previously, it searched among storage metadata columns, but the part might not have files for any of those columns if the table schema changed after the part was created. The fix uses the part's own columns instead of metadata columns, ensuring we always find a column that exists in the specific part. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Contributor
|
Workflow [PR], commit [8cd443f] Summary: ❌
|
Test that reading from a MergeTree table works correctly after schema changes (adding new columns, dropping original columns) when the part's columns differ from the current table metadata. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The test passed but did not actually trigger the bug scenario that was found by BuzzHouse fuzzer. The fix will be validated by CI (BuzzHouse should not crash anymore after the fix). Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Member
Author
|
Looks reasonable. |
Member
Author
|
The fix is strange. Now we can read from a column, which no longer exists in the storage. But there should be no such cases. Please revert if this fix has complications. |
Contributor
|
Hi @alexey-milovidov — while reviewing this PR I found the following:
Happy to discuss — close anything that's wrong or already addressed. |
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.
When no physical columns are needed for reading a part during merge,
injectRequiredColumnstries to find a minimum size column to determine row count. Previously, it searched among storage metadata columns, but the part might not have files for any of those columns if the table schema changed after the part was created.The fix uses the part's own columns instead of metadata columns, ensuring we always find a column that exists in the specific part.
Changelog category (leave one):
See https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=95065&sha=e047a3f739277d9272ec5108eb879df601c7aaf7&name_0=PR&name_1=BuzzHouse%20%28amd_ubsan%29
#95065