Repository navigation
Fix patch pruning for parenthesized sorting keys - #118878
Conversation
Use `IAST::formatIgnoringRedundantParentheses` when comparing effective sorting-key expressions. Equivalent spellings such as `k` and `(k)` retain the common prefix needed for patch range pruning. Add a regression test covering pruning, key spelling changes, and patch materialization. Related: ClickHouse#118024 Related: ClickHouse#103182
|
Workflow [PR], commit [0530c39] Summary: ✅
AI ReviewSummaryThis PR fixes the v2 patch-key common-prefix comparison for single-element sorting keys written with redundant parentheses and adds a focused regression test around pruning and post- Findings
Final VerdictChanges requested. LLVM Coverage ReportMeasured on commit 0530c39.
Changed lines: Changed C/C++ lines covered: 3/3 (100.00%) · Uncovered code |
Use a nonzero `index_granularity_bytes` value so the test can create compact parts without warnings. Keep `index_granularity` at 128 rows for the patch-pruning assertion. CI report: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=118878&sha=e74fa4a6a1faa6a959c2e84a1cd85ddb86f788ad&name_0=PR&name_1=Fast%20test Related: ClickHouse#118878
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
The official master build is compiled with Compile time of recompiled translation units8 translation units recompiled, 16 s compile time in total, 8 of them have a recent master baseline. |
With
ORDER BY (k), the stored patch key can be parsed ask. Comparing the formatted expressions treats these equivalent keys as different and discards their effective common prefix, causing unnecessary patch reads even when the sorting key is unique. Compare expressions withIAST::formatIgnoringRedundantParenthesesto preserve the common prefix.Closes: #118024
Related: #103182
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Fix excessive patch-part reads for lightweight updates on tables with redundant parentheses in sorting-key expressions, such as
ORDER BY (k).Workflow [PR]
Sync PR [sync-upstream/pr/118878]
Version info
26.9.1.1287(included in26.9and later)