Support read in reverse order with virtual row#99198
Conversation
|
Workflow [PR], commit [7ecea2c] Summary: ❌
AI Review1) SummaryThis PR extends 2) Missing context (if any)
3) Findings (by severity)
4) Tests & Evidence
5) ClickHouse Compliance Checklist (Yes/No + short note)
6) Performance & Safety Notes
7) User-Lens Review
8) Final Verdict
|
38ed069 to
835da66
Compare
LLVM Coverage Report
PR changed lines: PR changed-lines coverage: 100.00% (21/21) |
Fgrtue
left a comment
There was a problem hiding this comment.
The change looks good in my opinion. The only thing that concerns me is the Stress test failure. @vdimir do you think it could be related?
I doubt this change can cause it, I created new issue but probably it's duplicate of #85771, since same error happens in CI with different stack trace |
PR ClickHouse#99198 extends `read_in_order_use_virtual_row` to `InReverseOrder` reads (ReadFromMergeTree.cpp:745-777). The PR's own test covers the reverse path only via joins; this adds a dedicated non-join test with multiple parts. `04045` exercises: DESC with preliminary merge, without preliminary merge, with a WHERE filter, and with a multi-column sort key. All four queries use two non-overlapping MergeTree parts to activate the reverse-order virtual row merge path. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
PR ClickHouse#99198 extends `read_in_order_use_virtual_row` to `InReverseOrder` reads (ReadFromMergeTree.cpp:745-777). The PR's own test covers the reverse path only via joins; this adds a dedicated non-join test with multiple parts. `04045` exercises: DESC with preliminary merge, without preliminary merge, with a WHERE filter, and with a multi-column sort key. All four queries use two non-overlapping MergeTree parts to activate the reverse-order virtual row merge path. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…al-row Add test for DESC order virtual row optimization (PR #99198)
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
read_in_order_use_virtual_rowoptimization for reverse-order reads.Note
Medium Risk
Touches MergeTree read-in-order execution paths and primary-key index access, which could affect query correctness/performance for reverse-order reads if edge cases around marks/index sizes are missed.
Overview
Enables the
read_in_order_use_virtual_rowoptimization when reading MergeTree parts in reverse order (ReadType::InReverseOrder) by selecting the appropriate mark position from the part’s primary-key index and guarding against missing PK values (e.g., final mark / index bounds).Updates the
03711_read_in_order_through_joinstateless test to run the reverse-order join case with the samelog_commentfor bothLEFTandINNERjoins and adjusts expectedOKrows accordingly.Written by Cursor Bugbot for commit 7ecea2c. This will update automatically on new commits. Configure here.