Repository navigation
Description
Description
GROUP_CONCAT renders MatrixOne BOOL values as the words false and true, while direct SELECT, CAST(... AS CHAR), CONCAT_WS, CTAS consumers, and MySQL-compatible boolean conversion use 0 and 1.
This changes the value only when BOOL is passed directly to 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_bool_conversion;
create database gc_bool_conversion;
use gc_bool_conversion;
create table src (id int primary key, flag bool);
insert into src values (1, false), (2, true), (3, null);
select id, flag, cast(flag as char), concat_ws('', flag)
from src order by id;
select group_concat(flag order by id separator '|') as direct_gc,
group_concat(cast(flag as char) order by id separator '|') as cast_gc,
group_concat(concat_ws('', flag) order by id separator '|') as concat_ws_gc
from src;The same direct aggregate was also executed through a View, CTAS, and a prepared statement.
Actual behavior
id flag cast(flag as char) concat_ws('', flag)
1 0 0 0
2 1 1 1
3 NULL NULL ''
direct_gc = false|true
cast_gc = 0|1
concat_gc = 0|1|
CTAS, View, and PreparedStatement consumers all preserve the unexpected false|true text.
Expected behavior
Direct BOOL aggregation should use the same text conversion as direct SELECT and explicit CAST, producing 0|1. MySQL 8.3.0 produces 0|1 for the same table and query.
Stability and controls
- Reproducer: 3/3 for direct SELECT, CTAS, View, and PreparedStatement paths.
- Conversion control:
CAST(flag AS CHAR)andCONCAT_WS('', flag)produce0/1in MatrixOne. - NULL control: direct BOOL aggregation skips the NULL row, as expected.
- MySQL 8.3.0 oracle: direct and explicit-cast aggregates both produce
0|1in 3/3 runs. - Failure atomicity: all aggregate probes are read-only; CTAS materializes the returned text without changing source rows.
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 a BOOL payload and passes the Go bool directly to fmt.Fprint, which emits false/true:
case types.T_bool:
return writeValue(*util.UnsafeFromBytes[bool](data))This bypasses MatrixOne's normal SQL boolean-to-string conversion. The aggregate should reuse the canonical SQL text conversion rather than Go's boolean formatter.
Regression coverage
After the fix, add aggregate-executor and SQL regression cases for false, true, and NULL through direct, grouped, ordered, CTAS/View, and prepared execution paths.
Related
- [Bug]: group_concat wrong result #17518 is an older GROUP_CONCAT row/value corruption issue; it does not cover BOOL payload formatting.
- [Bug]: GROUP_CONCAT loses temporal scale and exposes TIMESTAMP in internal UTC format #28657 covers temporal payload formatting in the same helper but is a separate type-semantic failure.
Activity
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)。测试证据
测试结论
测试通过。