Repository navigation
fix: preserve composite index access for joins - #32490
mergify[bot] merged 4 commits into
Conversation
Allow contiguous leading composite-key prefixes to drive index joins with exact runtime filters. Preserve complete-key candidate priority so partial prefixes do not displace selective lookups. Related to matrixorigin#32460
|
Unrelated CI blocker: the COMPOSE/PESSIMISTIC multi-CN BVT job failed only on the four protected-database privilege checks at The PR's exact diff changes only join-index planning and its tests, and its new The downstream Coverage job also failed its prerequisites because that required pessimistic BVT producer failed. No coverage verdict was calculated; this is the same unresolved blocker recorded above. The blocker marker and original After run completion, the downstream CI Required job rejected the same two failed inputs ( |
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? |
|
Queue requested — the merge queue status continues in this comment ↓. |
|
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: 6fb6fabf7e1edd1c2a6176c58db0a03d2cdb66f7
Assessment: approve
No actionable defects remain. The change reuses existing serialized runtime-filter machinery while preserving complete-key priority, residual predicates and unsupported-prefix safeguards.
Model: gpt-6.1-sol / max
Session: 01a1a004-90c3-73b1-acc9-3d4636452003 · slot 0 · generation 0
Validation:
-
Eight focused test roots passed, including all three added regressions: focused-plan.log; checks/1794354193731255043-3.json.
-
Full planner package passed: owning-plan.log; checks/1794354265524401054-3.json.
-
Isolation preflight, native provenance, unchanged source and all four discussion entries verified. Receipts and logs reconciled in review-validation.json.
-
Frozen current-head CI reports successful UT, SCA, coverage and both multi-CN BVT lanes.
Limitations:
-
Three preexisting unrelated planner subcases skipped.
-
No local distributed BVT rerun or production latency benchmark was performed.
|
@Mergifyio queue |
✅ Merged into
|
|
mo-bot review · Commit: New discussion was assessed; the previous review remains unchanged. |
What type of PR is this?
Which issue(s) this PR fixes:
Related to #32460.
What this PR does / why we need it:
Root causes
applyIndicesForJoinsrequired equality conditions for every declared secondary-index key part. AVALUESjoin supplying a valid contiguous leading prefix ofidx_control(user_id, run_id, event_type, event_idx)therefore received no index-join candidate and scanned the base table despiteFORCE INDEX.Changes
FORCE INDEXfallback, and keep residual base-scan predicates authoritative.VALUESquery, serialized two-key bounds, residual filters, non-leading keys, unsupported partial unique prefixes, complete-key forced fallback, and competing indexes in both catalog orders.UNION ALLequivalence, range boundaries, duplicate and partial prefixes, unmatched/NULL keys, residual predicates, andIGNORE INDEX.Issue-to-test proof for #32460
c8264f1e6fa6cbe79eb8734677bc147a7482184dbecause noidx_controlscan existed. It now requires the explicitidx_controlscan, retained filtered base scan, matching build/probe tags,MatchPrefix,RUNTIME_FILTER_KEY_SERIAL_FULL_V1, two varchar probe components, and a two-argumentserial_fullbuild expression.idx_tenant_unused(tenant, unused)precededidx_lookup(lookup), selecting the broad prefix. Both catalog orders now selectidx_lookup; the original forcedVALUESregression and all prefix-safety controls still pass.Validation
Original base proof (expected exit 1: no
idx_controlscan):.agents/skills/mo-dev/scripts/mo-cgo-test -v -count=1 -timeout=180s -run '^TestForceIndexJoinUsesLeadingCompositePrefix$' ./pkg/sql/planCompeting-index pre-repair proof (expected exit 1: broad prefix selected when ordered first):
.agents/skills/mo-dev/scripts/mo-cgo-test -o /tmp/issue-32460-go/plan-review.test -v -count=1 -timeout=180s -run '^TestIndexJoinPrefersCompleteKeyOverPartialPrefix$' ./pkg/sql/planCurrent focused proof (exit 0: both catalog orders, exact issue regression, and all safety controls):
.agents/skills/mo-dev/scripts/mo-cgo-test -o /tmp/issue-32460-go/plan-review.test -v -count=1 -timeout=180s -run '^(TestIndexJoinPrefersCompleteKeyOverPartialPrefix|TestForceIndexJoinUsesLeadingCompositePrefix|TestIndexJoinCompositePrefixSafetyBoundaries)$' ./pkg/sql/planComplete planner package (exit 0;
PASS,ok github.com/matrixorigin/matrixone/pkg/sql/plan 18.795s):Package selection and build (exit 0):
Vet (exit 0, empty output):
Distributed SQL proof (supporting run before the final candidate-order revision; total 11, success 11, failed 0, ignored 0, abnormal 0). Executed from the isolated mo-tester runtime directory with
method=runand exactlyissue_32460.sql:gofmtproduced no diff. The Go and SQL source diff checks passed. The generated BVT result retains two trailing spaces emitted byEXPLAINforValues Scan "*VALUES*", consistent with existing result files.Residual risks
pkg/sql/planpackage passed.