Repository navigation
fix(mongodb): allow sort and unwind pipeline stages - #28344
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? |
XuPeng-SH
left a comment
There was a problem hiding this comment.
Reviewed exact head 0cfb898. No confirmed blocking defect found; APPROVE.
The change is appropriately scoped to admission/validation rather than reimplementing MongoDB execution. I reviewed all six changed files and followed the existing plan transport, compiler and mongoscan/driver consumers:
- One stage switch now owns admission, avoiding the previous stale second allowlist. Sort is restricted to 1–32 ordered BSON fields with integer +/-1 directions; unwind requires a valid field path and type-checked, known options. JSON and execution-plan BSON revalidation still reject duplicates, unsafe operators and malformed payloads. The documented conservative dotted-path limits are enforced consistently.
- The executor copies and forwards the original ordered pipeline, appending the mapping projection only after it. It does not reorder sort/unwind/limit/skip or implement its own BSON comparison/null/array rules. MongoDB therefore remains responsible for scalar, missing/null/empty-array and nested-path semantics. A sort without a unique tie-breaker should not be treated as stable pagination; this change does not promise that guarantee. See the MongoDB unwind contract.
- The existing statement context covers aggregate/getMore and buffered-document consumption; error, conversion and output-budget failures close resources. The driver keeps allowDiskUse=false and the existing source admission, cursor batch, raw-byte, decoded-batch and statement-output budgets. High fan-out followed by a blocking stage can still consume substantial server CPU before cancellation; the capacity amendment explicitly acknowledges this, rather than claiming that returned-row budgets bound server intermediate work. There is no new MatrixOne per-row sorting/materialization, goroutine or cache.
- Tests cover accepted forms and plan round trips, 32/33 sort-key and 199/200 path boundaries, invalid directions/options/paths and execution-plan rejection. The real-server E2E scenario adds descending sort+limit, scalar unwind, two-way fan-out and preserved empty arrays without removing prior unsafe-stage coverage.
Validation in this review: complete diff/source inspection and git diff --check passed. I did not rerun a native MatrixOne/MongoDB E2E or high-cardinality benchmark locally; the E2E fixture and reported CI are not being represented as a fresh independent load test. The skill's design/resource checks informed the capacity and lifecycle assessment above.
Merge Queue Status
This pull request spent 33 minutes 49 seconds in the queue, with no time running CI. Waiting for
All conditions
ReasonPull request #28344 has been dequeued Pull request from fork cannot be queued. This pull request comes from a fork, and Mergify needs the author's permission to update its branch.
Failing checks:
HintYou should look at the reason for the failure and decide if the pull request needs to be fixed or if you want to requeue it. Tick the box to put this pull request back in the merge queue (same as
|
## What type of PR is this? - [ ] API-change - [ ] BUG - [ ] Improvement - [ ] Documentation - [ ] Feature - [ ] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: issue matrixorigin#28337 ## What this PR does / why we need it: fix(mongodb): allow sort and unwind pipeline stages --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
## What type of PR is this? - [ ] API-change - [ ] BUG - [ ] Improvement - [ ] Documentation - [ ] Feature - [ ] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: issue matrixorigin#28337 ## What this PR does / why we need it: fix(mongodb): allow sort and unwind pipeline stages --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
## What type of PR is this? - [ ] API-change - [ ] BUG - [ ] Improvement - [ ] Documentation - [ ] Feature - [ ] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: issue matrixorigin#28337 ## What this PR does / why we need it: fix(mongodb): allow sort and unwind pipeline stages --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
What type of PR is this?
Which issue(s) this PR fixes:
issue #28337
What this PR does / why we need it:
fix(mongodb): allow sort and unwind pipeline stages