Skip to content

fix(function): preserve exact FIELD numeric comparisons - #28429

Merged
XuPeng-SH merged 3 commits into
matrixorigin:mainfrom
ck89119:issue-28397-main
Sep 8, 2026
Merged

XuPeng-SH merged 3 commits into
matrixorigin:mainfrom
ck89119:issue-28397-main

Conversation

@ck89119

@ck89119 ck89119 commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

What type of PR is this?

  • BUG

Which issue(s) this PR fixes:

issue #28397

What this PR does / why we need it:

FIELD() now preserves exact numeric comparison semantics for DECIMAL operands and mixed signed/unsigned integer operands. DECIMAL values use scale-aware DECIMAL128/DECIMAL256 comparison instead of being coerced through DOUBLE, while mixed integers compare their 64-bit representations as MySQL does.

The regression coverage includes values around the 2^53 boundary, DECIMAL(38,0), high scale DECIMAL values, table columns, and mixed signed/unsigned integers.

Tests

  • .agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=120s -run '^TestField(DecimalExact)?$' ./pkg/sql/plan/function
  • .agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=300s ./pkg/sql/plan/function
  • .agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=180s -run '^TestIssue28397FieldKeepsExactNumericComparison$' ./pkg/tests/issues

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

@ck89119
ck89119 marked this pull request as draft September 8, 2026 14:26
@ck89119
ck89119 marked this pull request as ready for review September 8, 2026 14:26
@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.

Reviewed the complete diff at 9903875 against base/merge-base 8934da6. No confirmed blocking findings.

Coverage: FIELD overload resolution and registration; preservation of operand scales through implicit casts; DECIMAL128/256 equality including overflow-as-inequality; signed/unsigned 64-bit representations; BIT dispatch; constant/vector NULL handling, first-match and no-match behavior; all added unit and frontend integration tests. This is an R2 public numeric-correctness fix, exempt from the feature-design-document gate. Integer comparison agrees with MySQL Item_func_field::val_int (https://github.com/mysql/mysql-server/blob/8.0/sql/item_func.cc).

Unhappy-path closure: temporary getter/parameter/result-index slices are invocation-scoped and GC-owned, bounded by argument count and batch length; no new wait, goroutine, shared state or persistent resource. Output ownership stays with the existing vector result wrapper. Existing overload IDs remain unchanged and new implementations are appended; no disk/catalog format, authorization or build-platform changes. Runtime remains O(rows × arguments), with exact scale alignment only in decimal comparisons.

Evidence reused: successful exact-head MatrixOne ALL CI run 34238320433, including Linux UT, shared build and public BVT checks. Its UT log explicitly records TestIssue28397FieldKeepsExactNumericComparison and all seven named subtests passing (0.86s), and the issues owning package passing. The PR also records focused FIELD and owning function-package test commands. The frontend regression reuses the existing base-cluster fixture and covers real MySQL-protocol literal and table-column execution. No code changes made.

@mergify mergify Bot added the queued label Sep 8, 2026
@mergify

mergify Bot commented Sep 8, 2026 •

Copy link
Copy Markdown
Contributor

Merge Queue Status

  • ✅ Entered queue — 2026-09-08 16:10 UTC · Rule: main · triggered by rule Automatic queue on approval for main
  • 🟠 Checks running · in-place
  • 🚫 Left the queue — 2026-09-08 16:11 UTC · at 583cfb24d792f17ee37eb9910cddcd2c51ac2731

This pull request spent 1 minute 13 seconds in the queue, with no time running CI.

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

Reason

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

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 merged commit 1cfec4c into matrixorigin:main Sep 8, 2026
20 of 21 checks passed
@mergify mergify Bot added dequeued and removed queued labels Sep 8, 2026
@ck89119
ck89119 deleted the issue-28397-main branch September 9, 2026 03:05
VioletQwQ-0 pushed a commit to VioletQwQ-0/matrixone that referenced this pull request Sep 17, 2026
…#28429)

## What type of PR is this?

- [x] BUG

## Which issue(s) this PR fixes:

issue matrixorigin#28397

## What this PR does / why we need it:

`FIELD()` now preserves exact numeric comparison semantics for DECIMAL
operands and mixed signed/unsigned integer operands. DECIMAL values use
scale-aware DECIMAL128/DECIMAL256 comparison instead of being coerced
through `DOUBLE`, while mixed integers compare their 64-bit
representations as MySQL does.

The regression coverage includes values around the 2^53 boundary,
DECIMAL(38,0), high scale DECIMAL values, table columns, and mixed
signed/unsigned integers.

## Tests

- `.agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=120s -run
'^TestField(DecimalExact)?$' ./pkg/sql/plan/function`
- `.agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=300s
./pkg/sql/plan/function`
- `.agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=180s -run
'^TestIssue28397FieldKeepsExactNumericComparison$' ./pkg/tests/issues`

---------

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
VioletQwQ-0 pushed a commit to VioletQwQ-0/matrixone that referenced this pull request Sep 17, 2026
…#28429)

## What type of PR is this?

- [x] BUG

## Which issue(s) this PR fixes:

issue matrixorigin#28397

## What this PR does / why we need it:

`FIELD()` now preserves exact numeric comparison semantics for DECIMAL
operands and mixed signed/unsigned integer operands. DECIMAL values use
scale-aware DECIMAL128/DECIMAL256 comparison instead of being coerced
through `DOUBLE`, while mixed integers compare their 64-bit
representations as MySQL does.

The regression coverage includes values around the 2^53 boundary,
DECIMAL(38,0), high scale DECIMAL values, table columns, and mixed
signed/unsigned integers.

## Tests

- `.agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=120s -run
'^TestField(DecimalExact)?$' ./pkg/sql/plan/function`
- `.agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=300s
./pkg/sql/plan/function`
- `.agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=180s -run
'^TestIssue28397FieldKeepsExactNumericComparison$' ./pkg/tests/issues`

---------

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
VioletQwQ-0 pushed a commit to VioletQwQ-0/matrixone that referenced this pull request Sep 17, 2026
…#28429)

## What type of PR is this?

- [x] BUG

## Which issue(s) this PR fixes:

issue matrixorigin#28397

## What this PR does / why we need it:

`FIELD()` now preserves exact numeric comparison semantics for DECIMAL
operands and mixed signed/unsigned integer operands. DECIMAL values use
scale-aware DECIMAL128/DECIMAL256 comparison instead of being coerced
through `DOUBLE`, while mixed integers compare their 64-bit
representations as MySQL does.

The regression coverage includes values around the 2^53 boundary,
DECIMAL(38,0), high scale DECIMAL values, table columns, and mixed
signed/unsigned integers.

## Tests

- `.agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=120s -run
'^TestField(DecimalExact)?$' ./pkg/sql/plan/function`
- `.agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=300s
./pkg/sql/plan/function`
- `.agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=180s -run
'^TestIssue28397FieldKeepsExactNumericComparison$' ./pkg/tests/issues`

---------

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>

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/M Denotes a PR that changes [100,499] lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants