Skip to content

feat(plan): support Boolean composition of indexed MATCH - #30190

Merged
mergify[bot] merged 8 commits into
matrixorigin:mainfrom
VioletQwQ-0:codex/issue-30166-boolean-composition-20261014
Oct 22, 2026
Merged

mergify[bot] merged 8 commits into
matrixorigin:mainfrom
VioletQwQ-0:codex/issue-30166-boolean-composition-20261014

Conversation

@VioletQwQ-0

@VioletQwQ-0 VioletQwQ-0 commented Oct 14, 2026 •

Copy link
Copy Markdown
Collaborator

What type of PR is this?

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

Which issue(s) this PR fixes:

issue #30166

What this PR does / why we need it:

Classic FULLTEXT and FULLTEXT2 currently reject scan-local MATCH(...) OR scalar_predicate and NOT MATCH(...) with error 20105. This change supports those predicates, including nested AND/OR/NOT, while retaining nonmatching rows that qualify through a scalar branch and returning overlapping matches once per base row.

The composition path attaches one complete, unique raw-score stream per distinct bound MATCH leaf with preserving LEFT joins, normalizes absent scores to typed zero below user outer joins, and evaluates the original Boolean expression in a FILTER. Emitted zero and negative scores, scalar SQL NULLs, and exact term/mode/parameter identities remain intact. Served scores can be consumed by projection, aggregation, windows, and ordering. Explicit FORCE INDEX FOR JOIN hints reach the same path. Cross-binding, missing-index, mismatched-index-parts, and unserved-score consumers retain their explicit refusal behavior.

This route requires a MATCH beneath OR/NOT in a scan-local WHERE predicate. Existing positive and projection-only MATCH membership behavior is unchanged; standalone projection does not globally gain zero-score rows. Fulltext candidate limits and ANN truncation are disabled for this composition path: explicit distance/score ordering and LIMIT/OFFSET operate on the complete Boolean-filtered set. FULLTEXT2 keeps its existing asynchronous visibility contract.

Design: exact approved design content, originally reviewed at dce89ab1ad4f61eb157c84c2cd55e89902fbaa87 (content SHA256 df7d8bafc2772d79fe18934226c1c3608e51573348ba97494d6e9bc1e32a1925). User-facing supported/refused semantics are documented in docs/sql/fulltext-boolean-composition.md.

Validation completed on the reviewed candidate source:

  • Independent design and implementation reviews passed, including the FORCE JOIN correction. All 14 ^TestFullTextBoolean tests passed; owning planner/provider packages with all vet analyzers and incremental affected-package lint passed.
  • Clean production base 5a0570ea70083c9365719009a5ed8d7618f9ed91: 12/12 checks, comprising eight expected real 20105 receipts across both engines and four positive/projection-only controls.
  • Native Go 1.27.1 Darwin arm64 service: canonical normal comparison of fulltext_boolean_composition, fulltext2_boolean_composition, and fulltext_wrapped_score, twice on the same instance, each 235/235 with zero failed/ignored/abnormal cases. The reviewed SQL/result pairs were unchanged; database/snapshot teardown was verified between runs.
  • Supplemental execution: 50 semantic checks, 20 real EXPLAIN ANALYZE checks, and two JDBC server-prepared subprocess checks, all passing (72/72). Includes three-valued logic, nullable multi-column content, signed/zero scores, exact leaf projection binding, duplicate-leaf controls, FORCE JOIN hints, global pagination, and exact vector sorting with an IVF index present. Binary prepared statements were reused across terms/thresholds/NULL/absent patterns, including classic error 20301 followed by successful reuse. Historical/current snapshot results demonstrably differed under each provider's visibility contract.
  • Actual core Analyze counters show complete 3-hit streams, preserving joins with 8 base rows, Boolean filtering 8→5, and outer pagination 5→2. Repeated leaves use one stream; distinct leaves use two. A signed fixture emits all four scores, including one negative and three exact zeros. Owned processes/data/sockets/ports were cleaned.

Original publication provenance: reviewed original head 8c39a92bc3da43b88be525ae3da50b9e7bc0a434; Mac execution used temporary commit 027e413ee700edf3e4810606f06ae6a6cf2e5c2d. That original publication only normalized the three local commits' author/committer identity. All three final heads have exactly the same complete Git tree d721a6d69f1a24ded1087fa1a47ae8ea8e47a517, independently audited; no source change or duplicate runtime rerun was introduced by history recovery or attribution.

Limits: bounded single-CN CPU validation, not production-scale capacity/performance, HNSW runtime, multi-CN, GPU/Sirius, or full repository CI. The separate #30164 optimization is not included; combined changes have planner-layer evidence only. Latest-main preflight at fab7b5c0430a475bf64ad1619ce4d5249013a138 merges cleanly, but its join/CTE changes have not been rerun as a combined runtime build. Local independent design, implementation, runtime acceptance, and cleanup gates are complete; this PR is ready for review. External repository approval and hosted CI remain merge gates, with no approval or CI-pass claim. Mergify subsequently merged that main into this branch at 1188011cbd8638bfc2219839b579d089d5199c60 (tree b0241134ebc52db0d18f0653eb595f3c0967710a); all 17 feature-change paths retain their reviewed bytes and modes. Original local execution remains proof at its recorded source tree; combined merged-main integration remains subject to hosted CI; see the scoped maintenance status below.

Scoped CI maintenance

Maintenance commit: bab2e835a0919d08e9646df8fc9bbb109263f7ca. This is an additional test-only correction, not part of the original identity-only publication described above.

The source-head coverage failure in run 38599892439 came from the broadcast ownership fixture choosing scheduler completion when both completion and empty-consumer retirement were already observable. The waiter now rechecks retirement and preserves the received scheduler result for the unchanged terminal/error assertions. Genuine early completion, cancellation/deadline/error propagation, source interruption, output and allocation cleanup assertions remain intact.

Validation on source 15f3a5db33e56899d9292436d1502811cd4ec2a9 plus this exact maintenance patch (Darwin arm64, Go 1.27.1, genuine matching native CPU SDK, GOMAXPROCS=2, build parallelism=1):

  • Coverage mode set, all vet analyzers, all five directly affected ownership roots and their subcases: PASS.
  • Each affected root under race detection, then adaptive repetitions computed as clamp(floor(30 / measured_seconds), 1, 100): PASS. The five roots are Product/HashJoin/LoopJoin shared-producer ownership and HashJoin/LoopJoin remote-source ownership.
  • Owning-package normal tests were executed: the five affected roots passed, but the package is not green because TestUnionNestedTopClearsAllocationOwners failed with a spill-budget error. A root-only five-run control also failed on the unmodified source (1/5) and candidate (3/5); that test never calls the changed helper. These controls establish an independent test instability, not a blanket attribution of every failure variant or product acceptance. No UNION expectations or resource budget were changed.
  • Scoped molint, incremental configured golangci-lint and diff/format checks: PASS.

For this maintenance delta, BVT is N/A: only a Go fixture's event-order oracle changes, with no production SQL entry point. The five real-operator ownership roots supply the corresponding regression evidence; the feature's canonical SQL/result pairs remain unchanged. Source15f hosted ordinary UT, SCA and both BVT jobs passed, while coverage/CI Required failed; none of those old runs is presented as new-head CI.

QA required: yes. This remains a user-visible FULLTEXT feature. Original bounded single-CN acceptance stays bound to its recorded original tree; deployment/multi-CN/capacity gates and external review remain separate. No issue closure, review approval, full-package success or new-head hosted-CI success is claimed by this maintenance update.

Rebase and current validation (2026-10-22)

Current source: 5856b5a679197f302a655749cc54a1fbf5f46b90, rebased onto main 0276f82fb72941efba8d2f8de738f1cb04174dae. This section records current-source evidence; the earlier receipts remain historical evidence at their stated revisions.

The vector-routing conflict preserves both the Boolean composition exact-sort refusal and main's plugin membership capability. The original merge-only IVF mixed-OR assertion is restored alongside main's volatile-filter control; the existing capability table now checks Boolean refusal for IVFFLAT, HNSW, CAGRA and IVFPQ. The old broadcast fixture workaround is superseded by main's durable completion handling and introduces no compile-package delta.

Normal comparison exposed 13 stale metadata header lines. Two Boolean result files now follow main's deliberate computed-BOOL numeric TINYINT contract from #30191; the wrapped-score fixture now expects precision 20 for its declared VARCHAR(20). SQL, row values, NULLs, ordering and error assertions remain unchanged; results were not regenerated.

Validation on Linux/amd64, Go 1.27.1, fresh matching CPU native artifacts and disk-backed temporary storage:

  • Complete planner, classic search reader, FULLTEXT2 search reader and FULLTEXT2 core packages pass normal tests and go test -race -count=1 with bounded timeouts. These runs include existing roots, not just new cases.
  • Both originally failing CI roots, TestIssue30090ReplaceViewLifecycleOrder and TestISCPExecutor3, pass on the combined source with matrixone_test. Main contains their synchronization corrections from test: fence cross-CN view visibility in prepared-reader rebind test #30382 and fix: preserve empty flush snapshots and synchronize async CI tests #30632.
  • Incremental go vet and configured golangci-lint pass for all four affected packages; lint reports zero issues. Molint retains two existing recover diagnostics in untouched FULLTEXT2 storage functions; the same diagnostics were independently reproduced on clean target 0276f82fb7. No new delta finding is hidden.
  • Normal comparison of the three canonical fulltext SQL/result pairs passes 235/235 twice on the same owned instance, with zero failed, ignored or abnormal cases. Database and snapshot teardown checks pass after each iteration.
  • An independent JDBC control asserts stored BOOL versus computed BOOL types, precisions and true/false/NULL values, plus VARCHAR(20) metadata/values. Statement, client-prepared and actual server-prepared execution pass; the server-prepared class is explicitly checked to exclude fallback.

Design, metadata addendum and final overall review use gpt-6.1-sol / xhigh. Design sessions: 01a160f2-20f7-7072-9274-93df5a897de9 and 01a160fa-b994-7211-976d-8af38b838e87. Final review: session 01a160fd-f414-74c0-82be-acd213747d5a, reviewed 5856b5a679: PASS, zero unresolved material blockers.

This remains bounded single-CN CPU validation. No new GPU, multi-CN or production-capacity claim is made. Fresh hosted CI results remain pending after publication.

@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 →

@XuPeng-SH

XuPeng-SH commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

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

Commit: 5856b5a679197f302a655749cc54a1fbf5f46b90

Review completed. Read the assessment.

@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: 5856b5a679197f302a655749cc54a1fbf5f46b90

Assessment: approve

Reviewed the complete 20-file delta and affected callers. The approved design preserves base rows through Boolean evaluation, normalizes missing scores below outer joins, and reuses existing search and execution owners. Legacy positive/projection behavior remains intact. No actionable findings remain; complete-stream joins and exact vector sorting are accepted correctness costs.

Model: gpt-6-astra / xhigh

Session: 01a13dcf-1517-7f90-b3f9-c5f9f9e7031b · slot 0 · generation 1

Validation:

  • Verified the approved design revision and SHA256; subsequent design changes contain approval metadata only, closing the earlier review objection.

  • Reconciled exact-head CI run 39700012142 with retained logs: Go 1.27.1 Linux/amd64 race UT passed, including all 4,063 planner tests across eight successful shards and the affected provider-package selection.

  • Verified BVT results: classic Boolean composition 80/80, wrapped-score compatibility 74/74, FULLTEXT2 Boolean composition 81/81; zero failures, ignored statements or abnormal results.

  • Verified successful ARM64 SCA, local diff checks, clean source identity, and command/source/exit receipts against retained artifacts. Audit and detailed assessment: /home/xupeng/.local/state/mo-bot/jobs/49b28723f820610254fe3af1/attempt-1/review-audit.log and review-report.txt.

Limitations:

  • Reused exact-head CPU CI without duplicating native tests locally. local_validation was empty; unretained author execution claims were not treated as verified evidence.

  • No production-scale performance or GPU measurements. Complete-stream memory/work costs and existing FULLTEXT2 asynchronous visibility remain documented limitations.

  • The linked issue contract was assessed through the frozen PR and versioned design; no separate issue snapshot was supplied.

@mergify mergify Bot added the queued label Oct 22, 2026
@mergify

mergify Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Merge Queue Status

  • ✅ Entered queue — 2026-10-22 01:53 UTC · Rule: main · triggered by rule Automatic queue on approval for main
  • ✅ Checks passed · in-place
  • ✅ Merged — 2026-10-22 05:36 UTC · at 0f7616a4e02bcfeaa9a2dfb579a3918a88582706 · squash

This pull request spent 3 hours 43 minutes 16 seconds in the queue, including 1 hour 3 minutes 33 seconds running CI.

Required conditions to merge

This branch was previously deployed

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

Labels

kind/documentation Improvements or additions to documentation kind/feature kind/test-ci size/XXL Denotes a PR that changes 2000+ lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants