Repository navigation
Description
Description
GROUP_CONCAT emits warning 1260 after truncation, but with multiple GROUP BY groups the reported Row N diagnostics do not identify the same rows as MySQL. The diagnostic numbers are generated in MatrixOne's aggregate-finalization order rather than the input-row order used by MySQL.
Environment
- Branch:
main - Commit:
e7d46d6dfb27696211ca828c55e245d3bd1b634d - Deployment: local standalone, 1 CN / 1 TN / 1 LogService
- Oracle: MySQL 8.3.0
Steps to reproduce
create database gc_warning_row;
use gc_warning_row;
create table src (g int, id int, v varchar(20), primary key (g, id));
insert into src values
(3,1,'p'), (3,2,'q'), (3,3,'r'),
(1,1,'aa'),(1,2,'bbb'),(1,3,'cccc'),
(2,1,'x'), (2,2,'yy'),(2,3,'zzz');
set session group_concat_max_len = 4;
select g, group_concat(v order by id separator '|') as gc
from src group by g order by g;
show warnings;Actual behavior
MatrixOne returns the correct aggregate values, but the warning rows are:
Warning 1260 Row 8 was cut by GROUP_CONCAT()
Warning 1260 Row 5 was cut by GROUP_CONCAT()
Warning 1260 Row 3 was cut by GROUP_CONCAT()
The diagnostic set itself is wrong (3,5,8), not merely ordered differently.
Expected behavior
MySQL 8.3.0 returns the same aggregate values and these diagnostics:
Warning 1260 Row 2 was cut by GROUP_CONCAT()
Warning 1260 Row 5 was cut by GROUP_CONCAT()
Warning 1260 Row 8 was cut by GROUP_CONCAT()
MatrixOne should report warning row numbers according to the input-row diagnostic contract, independent of internal group finalization order.
Stability and controls
- Reproducer: 3/3 on the stated MatrixOne commit; output SHA-256 was identical in all runs.
- MySQL oracle: 3/3; output SHA-256 was identical in all runs.
- Control: a single-group truncating aggregate still reports
Row 2, and non-truncating aggregates emit no warning. - Result values and warning count remain correct; only the row diagnostics are incorrect.
Evidence
- Reproducer:
evidence/group_concat/group_concat_multi_group_warning.sql - MatrixOne output SHA-256:
04fb53283c78fee0b46e166f8c7de227f4e6f0ca80762b24653d9755974b16d8 - MySQL output SHA-256:
e4fdbe1e45202a0eeacd4b1cf15053c7525ab56631d375b351d3bd5ca43a06ec
Code analysis
In pkg/sql/colexec/aggexec/concat2.go, FlushWithContext finalizes executor groups and nextWarningRow increments one executor-global counter while each group is being rendered. Consequently, recordTruncation receives a position derived from finalization traversal and the number of entries visited in preceding groups, rather than the source row ordinal that produced the truncation. Internal group order can differ from SQL input order.
Regression coverage
After the fix, add a multi-group case with unequal value lengths and assert the exact SHOW WARNINGS row diagnostics, plus controls for reversed outer ORDER BY, multiple aggregate instances, and a non-truncating query that clears diagnostics.
Related
- [Compatibility]: GROUP_CONCAT truncation does not emit MySQL warning 1260 #28252 added missing warning 1260 emission; this issue covers incorrect row diagnostics after warning emission was implemented.
- fix(sql): report group concat truncation warnings #28504 implemented the warning path used by current
main.
Activity
fix: preserve GROUP_CONCAT warning source rows (#28747)
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: preserve GROUP_CONCAT warning source rows (matrixorigin#28747)
fix: preserve GROUP_CONCAT warning source rows (matrixorigin#28747)
fix: preserve GROUP_CONCAT warning source rows (matrixorigin#28747)