Skip to content

fix(planner): honor query-level IVF nprobe options - #30002

Merged
mergify[bot] merged 3 commits into
matrixorigin:mainfrom
iamlinjunhong:fix/28996-rank-nprobe
Oct 13, 2026
Merged

mergify[bot] merged 3 commits into
matrixorigin:mainfrom
iamlinjunhong:fix/28996-rank-nprobe

Conversation

@iamlinjunhong

Copy link
Copy Markdown
Contributor

What type of PR is this?

  • API-change
  • BUG
  • Improvement
  • Documentation
  • Feature
  • Test and CI
  • Code Refactoring

Which issue(s) this PR fixes:

What this PR does / why we need it:

LIMIT ... BY RANK WITH OPTION 'nprobe=N' now overrides the session probe_limit base for both IVFFLAT and IVF-PQ, including when no mode is specified. Previously the planner discarded this option and always used the session value.

The option is validated as an integer in 1–80000, carried through plan serialization, deep copies and UNION planning, and resolved by both IVF planners. Existing AUTO amplification and adaptive widening, FORCE behavior, and exact PRE search are preserved. Queries without an override retain existing defaults. Unsupported fudge_factor, unknown keys, malformed key/value strings and nonliteral options now return explicit errors.

Validation:

  • Focused regressions and complete pkg/sql/plan, pkg/sql/parsers/dialect/mysql, and pkg/pb/plan tests passed, including IVF-PQ emitted configuration and AUTO query-base propagation.
  • Changed-package go vet, incremental golangci-lint, formatting and diff checks passed; CPU service build passed.
  • New SQL BVT passed twice on an isolated 1 CN / 1 TN / log-service instance: 35/35 statements each run. It checks EXPLAIN probe values against session defaults, deterministic results, prepared execution, rejected options and cleanup.

No per-row processing cost is added. The plan field is additive; query option support requires updated planners. GPU IVF-PQ execution was not run on this CPU host; its planning and emitted search configuration are covered by CPU tests. PR CI remains pending. The reported issue should be verified by its reporter after merge.

@qodo-code-review

Copy link
Copy Markdown

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

@mergify mergify Bot added the kind/bug Something isn't working label Oct 12, 2026
@XuPeng-SH

XuPeng-SH commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

mo-bot review · mo-bot-local · superseded

Commit: afc175098973e757da43ecdfec0ceba35b2a275b

Review belongs to an older commit; it is not a review of the current head.

@matrix-meow matrix-meow added the size/XXL Denotes a PR that changes 2000+ lines label Oct 12, 2026

@aunjgr aunjgr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 6788289 against merge-base f802ab6. No blocking finding.

The parser rejects malformed/nonliteral option payloads, the planner validates nprobe against the existing session domain, and explicit overrides bypass session lookup without mutating it. The additive field survives serialization, deep copy and mode-less UNION planning. Both IVF consumers use the selected base; AUTO amplification/final POST propagation, FORCE and existing defaults remain owned by their existing paths.

Reviewed the production delta, generated field/action changes and test closures. Reused reported owning tests, static checks, CPU build and twice-repeated normal SQL comparison with current-head CI. The extended IVF tests retain previous default/INCLUDE/adaptive controls while adding query-base and emitted IVF-PQ configuration assertions. No local native service or GPU execution was rerun by me; GPU runtime validation is not claimed.

@XuPeng-SH

XuPeng-SH commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

mo-bot review · mo-bot-local · done

Commit: 64b2ab9f599510fa538e546e07cef77667311980

Assessment: approve

Reviewed the complete 17-file delta and affected consumers. Query-level nprobe reaches both IVF planners, preserves existing search policies and defaults, and survives copying and serialization. No actionable defects remain.

Model: gpt-6-astra / xhigh

Session: 01a12d8f-7dea-77c2-a565-38d45b5564e4 · slot 0 · generation 0

Validation:

  • 24 focused tests passed across planner, MySQL parser and plan protobuf packages, covering boundaries, rejection, defaults, UNION propagation, AUTO, FORCE and emitted IVF-PQ configuration.

  • Audited generated parser changes and the complete protobuf descriptor; only the intended semantics and additive nprobe field changed.

  • Verified native-input provenance, executor preflight, exact-head command receipts and retained logs. Source remained clean.

  • Frozen evidence reports successful exact-head build, Linux UT, static analysis and both BVT groups.

  • Detailed scope and receipt reconciliation are retained in attempt-1/review-map.json and attempt-1/validation-evidence.json.

Limitations:

  • GPU execution was not run; CPU tests verify emitted configuration, and the unchanged GPU consumer was traced.

  • Public SQL case/results were reviewed; CI conclusions were reused. Underlying CI logs and the author's separate BVT logs were unavailable for independent audit.

  • The linked issue body was absent from the frozen packet; review used the behavioral contract documented in the PR.

@XuPeng-SH XuPeng-SH left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mo-bot review · mo-bot-local · review

Commit: 64b2ab9f599510fa538e546e07cef77667311980

Assessment: approve

Reviewed the complete 17-file delta and affected consumers. Query-level nprobe reaches both IVF planners, preserves existing search policies and defaults, and survives copying and serialization. No actionable defects remain.

Model: gpt-6-astra / xhigh

Session: 01a12d8f-7dea-77c2-a565-38d45b5564e4 · slot 0 · generation 0

Validation:

  • 24 focused tests passed across planner, MySQL parser and plan protobuf packages, covering boundaries, rejection, defaults, UNION propagation, AUTO, FORCE and emitted IVF-PQ configuration.

  • Audited generated parser changes and the complete protobuf descriptor; only the intended semantics and additive nprobe field changed.

  • Verified native-input provenance, executor preflight, exact-head command receipts and retained logs. Source remained clean.

  • Frozen evidence reports successful exact-head build, Linux UT, static analysis and both BVT groups.

  • Detailed scope and receipt reconciliation are retained in attempt-1/review-map.json and attempt-1/validation-evidence.json.

Limitations:

  • GPU execution was not run; CPU tests verify emitted configuration, and the unchanged GPU consumer was traced.

  • Public SQL case/results were reviewed; CI conclusions were reused. Underlying CI logs and the author's separate BVT logs were unavailable for independent audit.

  • The linked issue body was absent from the frozen packet; review used the behavioral contract documented in the PR.

@mergify

mergify Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Merge Queue Status

  • ✅ Entered queue — 2026-10-13 18:49 UTC · Rule: main · triggered by rule Automatic queue on approval for main
  • ✅ Checks passed · in-place
  • ✅ Merged — 2026-10-13 20:09 UTC · at 9d557f963f386efa17fdd2b17bda513977605762 · squash

This pull request spent 1 hour 20 minutes 2 seconds in the queue, including 1 hour 19 minutes 40 seconds running CI.

Required conditions to merge

This branch was previously deployed

1 inactive deployment
ci — 4565dfff Deployed Oct 13, 2026 by mergify[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/bug Something isn't working size/XXL Denotes a PR that changes 2000+ lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants