Repository navigation
fix(sql): honor first ordering key in Top and MergeTop - #33042
Conversation
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
|
This pull request is merged. |
|
mo-bot review · Commit: Review completed. Read the assessment. |
XuPeng-SH
left a comment
There was a problem hiding this comment.
mo-bot review · mo-bot-local · review
Commit: f34c94bcda34d305048aef92b6e1fecdc885dbb9
Assessment: approve
Top and MergeTop now use the first ordering specification for each shared column slot. Spill Top gives each logical key its own comparator, preserving tie-breakers and keeping scan cutoffs consistent with the leading key.
Model: gpt-6.2-sol / xhigh
Session: 01a1f0a0-5126-78f3-9ab8-ef4e87f2f119 · slot 0 · generation 3
Validation:
-
The full Top and MergeTop Go suites passed. The repeated-key tests returned wrong rows against the base operators, while the unique-key control passed.
-
An isolated single-CN MySQL probe passed both added SQL cases and binary prepared reuse across the spill threshold. EXPLAIN ANALYZE showed Top spilling 17,000 rows and 136.19 KiB.
-
The fixture oracle, isolation preflight, native input verification, and formatting checks passed. Receipts and logs are indexed in review-evidence.md.
Limitations:
-
The full BVT, race suites, and remote-CN probe are author-reported. The frozen unit and multi-CN CI checks were pending.
-
The frozen evidence references the related 4.2-dev PR #32402 without including its patch.
main now carries the squashed forms of the PRs this branch was stacked on, through matrixorigin#33027. The merged tree is this branch's own commits (4de8e4e..1cc5610) replayed onto main, with three conflicts and one semantic follow-up resolved: - top: processBatchResident takes main's ordering specs (matrixorigin#33042) and keeps this branch's retained-pool prologue. - external/reader_zonemap: main's rewritten saved-result reader (matrixorigin#33045) writes output vectors, including filled missing columns, through the operator's output pool; the loaded block stays on proc's pool. - group/collation_metadata_test: main's form of the same offset fix. - external/reader_zonemap_test (matrixorigin#33046): the capacity-failure cases bind an accounted output view instead of a per-vector allocation account, and pre-size the first column so the failure still lands on the second. Co-Authored-By: Claude Opus 5.5 <[email protected]>
What type of PR is this?
Which issue(s) this PR fixes:
Fixes #32396. Related to #32897 item 1 and the 4.2-dev fix #32402.
What this PR does / why we need it:
With repeated physical columns in ORDER BY, resident Top and heap MergeTop configured the shared comparator from the last occurrence. This could reverse a LIMIT result and give scan pruning a cutoff inconsistent with the leading key. Resident Top and heap MergeTop now use the first ordering specification for each physical slot, including its NULL placement.
Spill Top stores one vector per logical sort key. Direct spill and resident-to-spill migration now give each logical key an independent comparator. This also prevents repeated keys from aliasing mutable comparator bindings during migration. The change adds no work to row comparison and avoids building a physical-slot map on direct spill.
Validation