Repository navigation
Description
Description
GROUP_CONCAT formats FLOAT and DOUBLE arguments with Go's default float notation instead of MatrixOne's SQL text conversion. Values that direct SELECT and CAST(... AS CHAR) render in fixed or uppercase-exponent form are changed to lowercase scientific notation inside the aggregate.
Environment
- Branch:
main - Commit:
e7d46d6dfb27696211ca828c55e245d3bd1b634d - Deployment: local standalone (
1 CN / 1 TN / 1 LogService) - Oracle: MySQL 8.3.0, isolated local instance
Steps to reproduce
drop database if exists gc_float_conversion;
create database gc_float_conversion;
use gc_float_conversion;
create table src (id int primary key, f float, d double);
insert into src values
(1, 0.0000001, 0.0000001),
(2, 100000000000000000000, 100000000000000000000),
(3, 1.234567, 1.23456789012345),
(4, -0.0, -0.0),
(5, -123456.75, -123456.789012345);
select id, f, cast(f as char), d, cast(d as char) from src order by id;
select group_concat(f order by id separator '|') as direct_f,
group_concat(cast(f as char) order by id separator '|') as cast_f
from src;
select group_concat(d order by id separator '|') as direct_d,
group_concat(cast(d as char) order by id separator '|') as cast_d
from src;Actual behavior
MatrixOne returns:
direct_f = 1e-07|1e+20|1.234567|-0|-123456.75
cast_f = 0.0000001|1E+20|1.234567|-0|-123456.75
direct_d = 1e-07|1e+20|1.23456789012345|-0|-123456.789012345
cast_d = 0.0000001|1E+20|1.23456789012345|-0|-123456.789012345
The aggregate changes the string representation of values 1 and 2 even though the explicit SQL conversion does not.
Expected behavior
Direct numeric arguments to GROUP_CONCAT should use the same canonical SQL text conversion as CAST(value AS CHAR). MySQL 8.3.0 produces identical direct-aggregate and explicit-cast strings for both FLOAT and DOUBLE.
Stability and controls
- Reproducer: 3/3 for FLOAT and DOUBLE.
- Conversion control: direct SELECT and
CAST(... AS CHAR)agree in MatrixOne for the affected values. - Ordinary-value control:
1.234567, negative finite values, and the declared FLOAT/DOUBLE storage values remain readable. - MySQL 8.3.0 oracle: direct and explicit-cast aggregates are identical in 3/3 runs.
- Failure atomicity: all probes are read-only and leave the source rows unchanged.
Evidence
All three MatrixOne output files are byte-identical, and all three MySQL output files are byte-identical. Representative values are included above.
Code analysis
pkg/sql/colexec/aggexec/agg_payload.go::writeGroupConcatData decodes the binary float and passes it directly to fmt.Fprint:
case types.T_float32:
return writeValue(*util.UnsafeFromBytes[float32](data))
case types.T_float64:
return writeValue(*util.UnsafeFromBytes[float64](data))Go's default float formatting is not MatrixOne's SQL display conversion. The aggregate should reuse the canonical scale/notation conversion used by CAST and result serialization.
Regression coverage
After the fix, add aggregate-executor and SQL cases spanning fixed/scientific thresholds, positive and negative values, FLOAT/DOUBLE, grouped/ordered execution, and direct-vs-explicit-cast equality.
Related
- [Bug]: GROUP_CONCAT renders BOOL as false/true instead of SQL 0/1 #28658 covers BOOL formatting in the same helper.
- [Bug]: GROUP_CONCAT loses temporal scale and exposes TIMESTAMP in internal UTC format #28657 covers temporal scale/time-zone formatting in the same helper.
Activity
fix: align group_concat float formatting with cast (#28700)
Ariznawlll commentedon Sep 14, 2026
测试版本
原问题验证
Happy Path 覆盖
Unhappy Path 覆盖
白盒验证
回归测试
./motr --repeat 3 14_issue_regression.issue_28187_28772_latest_main连续 3/3 通过(213/213 statements matched)。测试证据
测试结论
测试通过。
fix: align group_concat float formatting with cast (matrixorigin#28700)
fix: align group_concat float formatting with cast (matrixorigin#28700)
fix: align group_concat float formatting with cast (matrixorigin#28700)