Skip to content

fix(python-sdk): preserve numeric fulltext relevance scores - #32042

Merged
mergify[bot] merged 1 commit into
matrixorigin:mainfrom
MatrixAdventurer:fix/python-fulltext-score-type
Nov 3, 2026
Merged

mergify[bot] merged 1 commit into
matrixorigin:mainfrom
MatrixAdventurer:fix/python-fulltext-score-type

Conversation

@MatrixAdventurer

Copy link
Copy Markdown
Contributor

What type of PR is this?

  • BUG
  • Test and CI

Which issue(s) this PR fixes:

Fixes #32027.

What this PR does / why we need it:

Selecting an unlabelled FulltextFilter through SQLAlchemy currently converts every nonzero MATCH relevance score into True. Declare the expression as Float so scores such as 0.09061906 and 0.75 remain distinct numeric values while the expression remains usable as a WHERE predicate.

Add nine offline regressions covering Boolean, natural-language and query-expansion expressions, unfiltered projections, bare WHERE predicates and numeric thresholds. Assertions cover distinct positive scores, zero, negative values and NULL, and verify MySQL SQL compilation retains MATCH without an '= 1' wrapper. SQLite execution substitutes stored scores only for server-side MATCH evaluation while retaining SQLAlchemy's actual result processing and predicates. This does not change the separate label() behavior reported in #32026.

Validation on main base 07c0607, Python 3.12:

  • All nine new regressions fail on the unmodified production baseline due to Boolean score conversion and pass with the fix.
  • Complete offline suite with SQLAlchemy 1.4.54: 2970 passed, plus 103 subtests; zero failures/skips.
  • Complete offline suite with SQLAlchemy 2.0.43: 2966 passed, plus 103 subtests; zero failures/skips.
  • Complete offline suite with SQLAlchemy 2.1.6: 2974 passed, plus 103 subtests; zero failures/skips.
  • Black checks for both changed files and git diff --check pass. Published tree matches the local tested tree.

Environment notes: the initial 2.1.6 collection lacked greenlet; after installing it, DDL tests exposed missing SDK dialect entry-point registration. Installing the SDK distribution and rerunning with the repository source first on PYTHONPATH produced the final full-suite pass above. Earlier runs before workspace restoration are not used as the final validation result.

Limits: no live MatrixOne fulltext server, SQL BVT, or performance benchmark was run. The tests isolate the SDK conversion defect and do not qualify server scoring/tokenization. Only two files change.

@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 kind/bug Something isn't working kind/test-ci labels Nov 3, 2026
@XuPeng-SH

XuPeng-SH commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

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

Commit: 3fefdc0defd77ef27e7ecab28781638a60af6bfb

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: 3fefdc0defd77ef27e7ecab28781638a60af6bfb

Assessment: approve

The Float result type correctly preserves relevance scores through projection, aggregates and derived queries while retaining predicate behavior. No actionable defects remain.

Model: gpt-6-astra / xhigh

Session: 01a1869d-820c-7212-9788-aecfb86a4141 · slot 0 · generation 2

Validation:

  • 101 focused tests passed, including all nine new regressions, on Python 3.11.14 / SQLAlchemy 2.0.43. Evidence: focused.log, focused.xml, checks/1793665721104691445-3.json.

  • Baseline controls reproduced boolean conversion; candidate controls passed for aggregates, subqueries, UNION ALL, empty/NULL results, predicates, dialect processors and Client.execute. Evidence: score-consumers-retry.log, checks/1793665802881483727-3.json.

  • Reused frozen-head CI results: eight SDK offline jobs and two core-import jobs succeeded.

  • Source remains unchanged. Review plan, complete discussion assessment and receipt reconciliation are retained in review-plan.md, discussion-assessment.json and review-validation.json.

Limitations:

  • No live MatrixOne scoring or multi-CN validation was performed; online CI was skipped. Local checks isolate the changed client conversion boundary.

  • The preexisting FulltextFilter.label issue #32026 remains outside this change.

@mergify mergify Bot added the queued label Nov 3, 2026
@mergify
mergify Bot merged commit da62af3 into matrixorigin:main Nov 3, 2026
@mergify

mergify Bot commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

✅ Merged into main as da62af3 at 00:32 UTC

Less than a minute in the queue, with no time running CI.

So far

  • ✅ Entered the queue Tue 3 Nov, 00:32 · rule main · triggered by rule Automatic queue on approval for main
  • ✅ Checks skipped · PR is already up-to-date
  • ✅ Merged 00:32 · da62af3 · squash
3 merge conditions met
  • #review-threads-unresolved = 0 · required by GitHub branch protection
  • github-review-approved · required by GitHub branch protection
  • any of · required by GitHub branch protection:
    • check-success = CI Required
    • check-neutral = CI Required
    • check-skipped = CI Required

Times in UTC · dashboard · how the merge queue works

@mergify mergify Bot removed the queued label Nov 3, 2026
MatrixAdventurer added a commit to MatrixAdventurer/matrixone that referenced this pull request Nov 3, 2026
Replace ad-hoc label object with SQLAlchemy Label while preserving standalone compile() strings. Keep upstream numeric Float fix from matrixorigin#32042 intact.

Refs matrixorigin#32026.

由LW授权的ChatGPT  Business智能体提交。
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 kind/test-ci

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Python FulltextFilter projection converts relevance scores to booleans

2 participants