Skip to content

fix(sql): support prepared fulltext boolean search - #24796

Merged
XuPeng-SH merged 30 commits into
matrixorigin:mainfrom
VioletQwQ-0:violet/issue-24735
Jul 20, 2026
Merged

XuPeng-SH merged 30 commits into
matrixorigin:mainfrom
VioletQwQ-0:violet/issue-24735

Conversation

@VioletQwQ-0

@VioletQwQ-0 VioletQwQ-0 commented Jun 3, 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 #24735

What this PR does / why we need it:

Supports prepared fulltext boolean search patterns such as MATCH(col) AGAINST(? IN BOOLEAN MODE).

Changes:

  • Parse fulltext search patterns as expressions for string literals and prepared statement parameters.
  • Bind and cast fulltext search patterns to varchar before building fulltext_match.
  • Keep fulltext index rewrite working for runtime pattern expressions.
  • Reject NULL and empty runtime patterns before reading or building the fulltext query.
  • Defensively reject empty pattern lists in the fulltext SQL layer.
  • Reset source table-function completion state after failed executions so prepared statements can be reused.
  • Add unit and BVT coverage for BOOLEAN/NL valid -> invalid -> valid prepared executions.

Validation:

  • make in pkg/sql/parsers/dialect/mysql
  • go test ./pkg/sql/parsers/dialect/mysql -count=1
  • go test ./pkg/sql/parsers/tree -count=1
  • go test ./pkg/fulltext -count=1
  • go test ./pkg/sql/colexec/table_function -count=1
  • go test ./pkg/sql/plan/explain -run TestFullTextSql -count=1
  • go test ./pkg/sql/plan -run 'FullText|fullText|fulltext' -count=1
  • git diff --check
  • BVT not run locally; covered by CI.

@VioletQwQ-0
VioletQwQ-0 requested a review from a user June 3, 2026 03:19
@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 Jun 3, 2026
@VioletQwQ-0
VioletQwQ-0 marked this pull request as draft June 3, 2026 03:26
@matrix-meow matrix-meow added the size/XXL Denotes a PR that changes 2000+ lines label Jun 3, 2026
@VioletQwQ-0
VioletQwQ-0 marked this pull request as ready for review June 3, 2026 07:13
@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 →

@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 commented Jun 24, 2026 •

Copy link
Copy Markdown
Contributor

Queued — the merge queue status continues in this comment ↓.

@mergify

mergify Bot commented Jun 24, 2026 •

Copy link
Copy Markdown
Contributor

Merge Queue Status

🛑 Queue command has been cancelled

mergify Bot and others added 3 commits June 24, 2026 07:21
# Conflicts:
#	pkg/sql/parsers/dialect/mysql/mysql_sql.go
#	pkg/sql/plan/apply_indices_test.go
# Conflicts:
#	pkg/sql/parsers/dialect/mysql/mysql_sql.go
@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 →

1 similar comment
@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 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.

The prepared-pattern path has a deterministic runtime panic because the former planning-time non-empty invariant was not moved to the execution boundary. Targeted parser, plan, fulltext, and table-function packages pass, but none covers dynamic empty/NULL input.

Comment thread pkg/sql/plan/base_binder.go Resolved
@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 →

# Conflicts:
#	pkg/sql/parsers/dialect/mysql/mysql_sql.go
# Conflicts:
#	pkg/sql/parsers/dialect/mysql/mysql_sql.go
@mergify

mergify Bot commented Jul 20, 2026 •

Copy link
Copy Markdown
Contributor

Merge Queue Status

  • ✅ Entered queue — 2026-07-20 05:34 UTC · Rule: main · triggered by @VioletQwQ-0 with the merge queue checkbox
  • 🟠 Checks running · in-place
  • 🚫 Left the queue — 2026-07-20 10:22 UTC · at 3626e480b262bada5e2d5a0009fc3feb60996834

This pull request spent 4 hours 47 minutes 20 seconds in the queue, with no time running CI.

Waiting for
  • any of: [🛡 GitHub branch protection]
    • check-neutral = Matrixone Compose CI / multi cn e2e bvt test docker compose(PESSIMISTIC)
    • check-skipped = Matrixone Compose CI / multi cn e2e bvt test docker compose(PESSIMISTIC)
    • check-success = Matrixone Compose CI / multi cn e2e bvt test docker compose(PESSIMISTIC)
  • any of: [🛡 GitHub branch protection]
    • check-neutral = Matrixone Standlone CI / Multi-CN e2e BVT Test on Linux/x64(LAUNCH, PROXY)
    • check-skipped = Matrixone Standlone CI / Multi-CN e2e BVT Test on Linux/x64(LAUNCH, PROXY)
    • check-success = Matrixone Standlone CI / Multi-CN e2e BVT Test on Linux/x64(LAUNCH, PROXY)
  • any of: [🛡 GitHub branch protection]
    • check-neutral = Matrixone Standlone CI / e2e BVT Test on Linux/x64(LAUNCH, PESSIMISTIC)
    • check-skipped = Matrixone Standlone CI / e2e BVT Test on Linux/x64(LAUNCH, PESSIMISTIC)
    • check-success = Matrixone Standlone CI / e2e BVT Test on Linux/x64(LAUNCH, PESSIMISTIC)
  • any of: [🛡 GitHub branch protection]
    • check-neutral = Matrixone Utils CI / Coverage
    • check-skipped = Matrixone Utils CI / Coverage
    • check-success = Matrixone Utils CI / Coverage
All conditions
  • any of [🛡 GitHub branch protection]:
    • check-neutral = Matrixone Compose CI / multi cn e2e bvt test docker compose(PESSIMISTIC)
    • check-skipped = Matrixone Compose CI / multi cn e2e bvt test docker compose(PESSIMISTIC)
    • check-success = Matrixone Compose CI / multi cn e2e bvt test docker compose(PESSIMISTIC)
  • any of [🛡 GitHub branch protection]:
    • check-neutral = Matrixone Standlone CI / Multi-CN e2e BVT Test on Linux/x64(LAUNCH, PROXY)
    • check-skipped = Matrixone Standlone CI / Multi-CN e2e BVT Test on Linux/x64(LAUNCH, PROXY)
    • check-success = Matrixone Standlone CI / Multi-CN e2e BVT Test on Linux/x64(LAUNCH, PROXY)
  • any of [🛡 GitHub branch protection]:
    • check-neutral = Matrixone Standlone CI / e2e BVT Test on Linux/x64(LAUNCH, PESSIMISTIC)
    • check-skipped = Matrixone Standlone CI / e2e BVT Test on Linux/x64(LAUNCH, PESSIMISTIC)
    • check-success = Matrixone Standlone CI / e2e BVT Test on Linux/x64(LAUNCH, PESSIMISTIC)
  • any of [🛡 GitHub branch protection]:
    • check-neutral = Matrixone Utils CI / Coverage
    • check-skipped = Matrixone Utils CI / Coverage
    • check-success = Matrixone Utils CI / Coverage
  • #review-threads-unresolved = 0 [🛡 GitHub branch protection]
  • github-review-approved [🛡 GitHub branch protection] (documentation)
  • github-review-decision = APPROVED [🛡 GitHub branch protection] (documentation)
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone CI / UT Test on Ubuntu/x86
    • check-neutral = Matrixone CI / UT Test on Ubuntu/x86
    • check-skipped = Matrixone CI / UT Test on Ubuntu/x86
  • any of [🛡 GitHub branch protection]:
    • check-success = Matrixone CI / SCA Test on Linux/arm64
    • check-neutral = Matrixone CI / SCA Test on Linux/arm64
    • check-skipped = Matrixone CI / SCA Test on Linux/arm64

Reason

Pull request #24796 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.

The author needs to enable "Allow edits from maintainers" on this pull request.

Failing checks:

Hint

You 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.
If you do update this pull request, it will automatically be requeued once the queue conditions match again.
If you think this was a flaky issue instead, you can requeue the pull request, without updating it, by posting a @mergifyio queue comment.

Tick the box to put this pull request back in the merge queue (same as @mergifyio queue).

  • Requeue this pull request

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

Re-reviewed head 89a002a. The previous blocker is fully addressed: dynamic NULL/empty patterns fail before value access or SQL construction, PatternToSql defensively rejects zero patterns, and source table-function Reset restores the execution generation after start errors. The repeated-Prepare cleanup also preserves the only compiler-injected state (optimized generate_series). Verified the generated parser is reproducible, the PR merges cleanly with current main, targeted parser/fulltext/planner/table-function tests pass, and the lifecycle matrix passes under the race detector. No remaining blocking correctness, performance, or unhappy-path issue found. Please sync the latest main before merge because the branch is currently behind.

This branch was previously deployed

1 inactive deployment
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.

7 participants