Skip to content

fix: normalize signed zero in ABS - #30168

Merged
XuPeng-SH merged 3 commits into
matrixorigin:mainfrom
iamlinjunhong:fix/30152-abs-negative-zero
Oct 14, 2026
Merged

XuPeng-SH merged 3 commits into
matrixorigin:mainfrom
iamlinjunhong:fix/30152-abs-negative-zero

Conversation

@iamlinjunhong

Copy link
Copy Markdown
Contributor

What type of PR is this?

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

Which issue(s) this PR addresses:

What this PR does / why we need it:

Floating-point negative zero compares equal to zero, so the existing v < 0 check in AbsSigned preserves its sign. Consequently, ATAN2(ABS(-0e0), -1e0) returns -PI() and a predicate comparing it to PI() loses a matching row.

Return a positive zero at the shared ABS helper boundary for either zero representation. Scalar and array ABS use this correction. Existing nonzero arithmetic, NaN/Inf behavior, and signed-integer overflow handling are preserved. The change adds one scalar comparison, with no additional allocation.

Regression coverage explicitly checks zero sign bits for float32/float64 and array consumers, downstream ATAN2 results, floating boundaries, and signed-integer overflow. The existing SQL ABS case checks constant expressions, FLOAT/DOUBLE row predicates, and NULL propagation.

Validation (Go 1.27.1, macOS arm64):

  • Focused ABS helper tests and the entire momath package passed.
  • Focused array/scalar/unsigned/decimal ABS tests and the entire moarray package passed using the repository CGo wrapper.
  • Incremental gofmt, vet, and golangci-lint checks passed (0 issues).
  • The existing ABS SQL BVT passed normal comparison twice on a test-owned single-node instance (50 passed, 0 failed; 2 historical [Question]: if GROUP BY alias nor aggregation function not supported, how do we support this kind of SQL? #3265 statements skipped). New signed-zero statements all executed. Teardown was verified before repeating.

CI has not run for this PR. The issue remains open for reporter verification after merge.

@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 14, 2026 •

Copy link
Copy Markdown
Contributor

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

Commit: a579075a8abdc954e93bd08216fca6e602532b1f

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: a579075a8abdc954e93bd08216fca6e602532b1f

Assessment: approve

Reviewed the complete five-file delta and scalar/array callers. Normalizing zero in the shared ABS helper is a coherent fix that preserves nonzero, NaN, infinity and integer-overflow behavior. It adds one comparison without new allocation or state. No actionable findings remain.

Model: gpt-6-astra / xhigh

Session: 01a12d8f-8e48-7622-ad17-b605f08450ce · slot 1 · generation 0

Validation:

  • Full momath package passed using the supplied executor; preflight passed.

  • Base-implementation overlay failed specifically on the new float32/float64 negative-zero assertions, confirming regression sensitivity.

  • Reused frozen-head successful build, Ubuntu UT, Linux arm64 SCA and both BVT-group statuses; inspected test selection and SQL assertions.

  • Verified clean source and matched local commands, fingerprints, exit receipts and logs. Retained audit: /home/xupeng/.local/state/mo-bot/jobs/684fce95df42029126b2b429/attempt-1/review-evidence.json.

Limitations:

  • Broader array/SQL coverage relies on supplied CI evidence; raw CI logs and author-local receipts were unavailable. No performance benchmark was run.

  • The linked issue's full body was absent; its behavioral contract was assessed from the frozen PR description and regression case.

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

mergify Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Merge Queue Status

  • ✅ Entered queue — 2026-10-14 16:58 UTC · Rule: main · triggered by rule Automatic queue on approval for main
  • 🟠 Checks running · in-place
  • 🚫 Left the queue — 2026-10-14 17:20 UTC · at 6adbc3dee2a8a2bc75ce1e3312db406db3083945

This pull request spent 21 minutes 53 seconds in the queue, with no time running CI.

Reason

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

Waiting for any of
  • check-neutral = CI Required
  • check-skipped = CI Required
  • check-success = CI Required
All conditions

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

  • Requeue this pull request

This branch was previously deployed

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

Labels

dequeued 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