Skip to content

fix: align group_concat float formatting with cast - #28700

Merged
XuPeng-SH merged 7 commits into
matrixorigin:mainfrom
aunjgr:fix/group-concat-float-format-28660
Sep 12, 2026
Merged

XuPeng-SH merged 7 commits into
matrixorigin:mainfrom
aunjgr:fix/group-concat-float-format-28660

Conversation

@aunjgr

@aunjgr aunjgr commented Sep 11, 2026 •

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

issue #28660

What this PR does / why we need it:

GROUP_CONCAT used Go's default float formatting, which can choose different fixed/scientific notation and exponent casing from MatrixOne's SQL CAST. As a result, aggregating a FLOAT or DOUBLE directly could differ from aggregating its CHAR conversion.

Use the same notation thresholds as CAST and preserve the original float32 or float64 precision when rendering aggregate payloads. Preserve negative zero and the existing non-finite-value spelling. Aggregate storage, ordering, and DISTINCT continue to use the original typed values.

Cover ordinary values, small and large exponents, negative zero, NULL, ordered/DISTINCT output, and prepared execution. Compare aggregate output with explicit CAST as an independent SQL conversion control.

Use MatrixOne's canonical fixed/scientific float formatting thresholds when GROUP_CONCAT renders FLOAT and DOUBLE values.
@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 →

Match the CAST-compatible formatter's negative-zero output in ordinary, DISTINCT, and prepared results. Expect the protocol's numeric BOOL result for the equality control.

@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 1e60fd9 against main 06de981: approve, no concrete blocker found.

The final-emission helper matches the current CAST floatToBytes implementation: the same float64 threshold comparisons, uppercase scientific notation outside the fixed range, and the original 32/64-bit formatting precision. I checked the float32 promotion/threshold boundary specifically: CAST also promotes the value before comparing, so this does not introduce a distinct float32 cutoff. Positive/negative values, +/-zero, NaN/infinities and finite extremes follow the same formatter semantics.

Collection, typed DISTINCT/order keys, partial aggregation, spill and merge payloads are unchanged. NULL rows remain skipped; separators and the bounded writer still own truncation/warnings. Fixed-payload length validation precedes decoding, and writeBytes preserves short-write/error propagation. There is no new shared state, session dependency, protocol field or metadata type change.

Performance: per-emitted-number formatting replaces fmt formatting; the temporary text is bounded by float representation length, not group cardinality. No new accumulated buffer or sort. This fixes output compatibility with CAST, not bitwise float equality or old-worker formatting during rolling deployment.

Evidence: full diff, exact-head CAST caller/helper comparison and ordinary/ordered/DISTINCT/prepared/NULL/negative-zero/nonfinite test-oracle inspection. Validation here is source-derived; I did not run a new native suite or benchmark and did not wait for CI.

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

mergify Bot commented Sep 12, 2026 •

Copy link
Copy Markdown
Contributor

Merge Queue Status

  • ✅ Entered queue — 2026-09-12 00:31 UTC · Rule: main · triggered by rule Automatic queue on approval for main
  • 🟠 Checks running · in-place
  • 🚫 Left the queue — 2026-09-12 00:34 UTC · at c522e046adfec6f50617f0eac0e7207d41eaf748

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

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

Reason

Pull request #28700 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 036193c into matrixorigin:main Sep 12, 2026
19 of 20 checks passed
@mergify mergify Bot added dequeued and removed queued labels Sep 12, 2026
VioletQwQ-0 pushed a commit to VioletQwQ-0/matrixone that referenced this pull request Sep 17, 2026
## What type of PR is this?

- [ ] API-change
- [x] BUG
- [ ] Improvement
- [ ] Documentation
- [ ] Feature
- [ ] Test and CI
- [ ] Code Refactoring

## Which issue(s) this PR fixes:

issue matrixorigin#28660

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

GROUP_CONCAT used Go's default float formatting, which can choose
different fixed/scientific notation and exponent casing from MatrixOne's
SQL CAST. As a result, aggregating a FLOAT or DOUBLE directly could
differ from aggregating its CHAR conversion.

Use the same notation thresholds as CAST and preserve the original
float32 or float64 precision when rendering aggregate payloads. Preserve
negative zero and the existing non-finite-value spelling. Aggregate
storage, ordering, and DISTINCT continue to use the original typed
values.

Cover ordinary values, small and large exponents, negative zero, NULL,
ordered/DISTINCT output, and prepared execution. Compare aggregate
output with explicit CAST as an independent SQL conversion control.

---------

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
## What type of PR is this?

- [ ] API-change
- [x] BUG
- [ ] Improvement
- [ ] Documentation
- [ ] Feature
- [ ] Test and CI
- [ ] Code Refactoring

## Which issue(s) this PR fixes:

issue matrixorigin#28660

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

GROUP_CONCAT used Go's default float formatting, which can choose
different fixed/scientific notation and exponent casing from MatrixOne's
SQL CAST. As a result, aggregating a FLOAT or DOUBLE directly could
differ from aggregating its CHAR conversion.

Use the same notation thresholds as CAST and preserve the original
float32 or float64 precision when rendering aggregate payloads. Preserve
negative zero and the existing non-finite-value spelling. Aggregate
storage, ordering, and DISTINCT continue to use the original typed
values.

Cover ordinary values, small and large exponents, negative zero, NULL,
ordered/DISTINCT output, and prepared execution. Compare aggregate
output with explicit CAST as an independent SQL conversion control.

---------

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
## What type of PR is this?

- [ ] API-change
- [x] BUG
- [ ] Improvement
- [ ] Documentation
- [ ] Feature
- [ ] Test and CI
- [ ] Code Refactoring

## Which issue(s) this PR fixes:

issue matrixorigin#28660

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

GROUP_CONCAT used Go's default float formatting, which can choose
different fixed/scientific notation and exponent casing from MatrixOne's
SQL CAST. As a result, aggregating a FLOAT or DOUBLE directly could
differ from aggregating its CHAR conversion.

Use the same notation thresholds as CAST and preserve the original
float32 or float64 precision when rendering aggregate payloads. Preserve
negative zero and the existing non-finite-value spelling. Aggregate
storage, ordering, and DISTINCT continue to use the original typed
values.

Cover ordinary values, small and large exponents, negative zero, NULL,
ordered/DISTINCT output, and prepared execution. Compare aggregate
output with explicit CAST as an independent SQL conversion control.

---------

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/S Denotes a PR that changes [10,99] lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants