Repository navigation
Description
Description
MatrixOne always reports a text GROUP_CONCAT result as MySQL protocol type BLOB with length 65,535. MySQL reports VAR_STRING while group_concat_max_len <= 512, and switches to a long text/blob protocol type only above that boundary.
The mismatch is visible on the result set itself, including server-side prepared statements, so JDBC/ORM clients can classify a short textual aggregation as a binary large object.
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
create database gc_meta_proto;
use gc_meta_proto;
create table t(id int, v varchar(20));
insert into t values(1,'aa'),(2,'bbb');
set session group_concat_max_len=4;
select group_concat(v order by id) as gc from t;
set session group_concat_max_len=512;
select group_concat(v order by id) as gc from t;
set session group_concat_max_len=513;
select group_concat(v order by id) as gc from t;Inspect protocol fields with a MySQL-compatible client, for example:
mysql -vvv --column-type-info ...Prepared path:
set session group_concat_max_len=4;
prepare p from 'select group_concat(v order by id) as gc from t';
execute p;
set session group_concat_max_len=513;
execute p;
deallocate prepare p;Actual behavior
MatrixOne reports the same metadata at every threshold and execution:
Type: BLOB
Collation: utf8mb4_general_ci
Length: 65535
Flags: BLOB
The textual values themselves are correct (aa,b at limit 4 and aa,bbb at larger limits).
Expected behavior
For textual arguments, protocol metadata should follow MySQL's threshold-dependent contract:
group_concat_max_len=4: Type=VAR_STRING
group_concat_max_len=512: Type=VAR_STRING
group_concat_max_len=513: Type=LONG_BLOB/TEXT-family
The prepared execution should likewise expose metadata appropriate to the effective prepare/execution limit. MySQL 8.3.0 changes the metadata from VAR_STRING to LONG_BLOB when the effective limit crosses 512.
Stability and controls
- Reproducer: 3/3 for direct protocol results at limits 4, 512, and 513.
- Prepared path: 3/3 when increasing the session limit from 4 to 513 between executions.
- Value control: MatrixOne and MySQL return the same aggregate bytes at every threshold.
- Text control: the input is
VARCHAR, and the returned collation is textual; this is not a binary-argument case. - MySQL 8.3.0 oracle: all three runs report
VAR_STRING,VAR_STRING, andLONG_BLOBat the respective thresholds.
Evidence
MatrixOne, runs 1-3 (five result sets per run):
Type=BLOB, Length=65535, Flags=BLOB
MySQL 8.3.0, runs 1-3:
limit 4: Type=VAR_STRING, Length=12
limit 512: Type=VAR_STRING, Length=1536
limit 513: Type=LONG_BLOB, Length=24624
prepared 4 -> 513: VAR_STRING -> LONG_BLOB
Code analysis
pkg/sql/colexec/aggexec/concat2.go::GroupConcatReturnType returns types.T_text for every nonbinary argument list and types.T_blob for binary inputs. It does not receive or apply group_concat_max_len:
func GroupConcatReturnType(args []types.Type) types.Type {
// binary inputs -> blob
// every other input -> text
}The runtime max length is refreshed only in the aggregate's extra configuration. The planned result type therefore remains fixed and cannot implement MySQL's 512-byte VARCHAR/VARBINARY threshold.
Regression coverage
After the compatibility behavior is implemented, add protocol/JDBC metadata coverage at 4, 512, and 513 for textual and binary inputs, plus prepared statements whose effective max length crosses the threshold.
Related
- [Compatibility]: prepared GROUP_CONCAT ignores MySQL prepare-time limit floor #28253 fixed prepared result-length floor semantics, not result-set type metadata.
- [Bug]: tracker for remaining CTAS schema inconsistencies with MySQL #24436 tracks CTAS schema inference differences; this issue occurs before CTAS in ordinary SELECT protocol metadata.
Activity
aunjgr commentedon Sep 15, 2026
@Ariznawlll We will retain the current GROUP_CONCAT TEXT/BLOB return-type rule rather than implement MySQL's 512-byte metadata switch at this point.
The report establishes a metadata compatibility difference, but the aggregate values are correct and textual results retain a textual collation. A BLOB-family wire type is not sufficient evidence that a client interprets the value as binary: MySQL uses these protocol codes for TEXT as well. In the inspected Connector/J implementation, the reported combination of BLOB code, length 65,535, and nonbinary collation maps to TEXT / JDBC LONGVARCHAR / String, not binary BLOB:
VARCHAR versus LONGVARCHAR can matter to particular applications, but no concrete application failure is demonstrated here. Making the result type depend on the session limit would add prepared-statement metadata complexity without an established benefit. Matching MySQL's field values alone is not enough reason to make that change.
Handing this back for evidence, while leaving the issue open. Please provide the affected driver/ORM and version, its actual metadata/object mapping, and a minimal application operation that fails against MO but succeeds against MySQL. The driver analysis above is source inspection, not a claimed live JDBC reproduction.
We can reconsider a targeted compatibility change if that evidence establishes a real problem. Incorrect charset, truncated values, or contradictory metadata remain actionable defects; retaining the current result-type policy does not excuse those.
aunjgr commentedon Sep 15, 2026
@Ariznawlll Clarifying the previous comment: binary/text correctness does not depend on whether an ORM happens to fail. A driver tolerating metadata is not proof that the metadata is correct.
Please distinguish these two questions:
A BLOB-family protocol type code alone cannot decide question 1, because these codes also describe TEXT; inspect the complete type/charset/flags combination.
Please verify VARCHAR and VARBINARY inputs at group_concat_max_len values 4, 512, and 513, including prepared execution across the threshold. Check complete metadata and returned values, using binary data containing NUL and non-UTF-8 bytes as controls. Expected max-length truncation must be distinguished from unintended decoding or byte conversion.
No code change is justified by the evidence currently reported: it demonstrates the size-based metadata difference, not binary/text misclassification. Keep the implementation unchanged unless the additional checks establish a semantic or metadata defect. The issue remains open with you for that verification.
Ariznawlll commentedon Sep 17, 2026
根据研发的产品决策,现将本 issue 中\u201c仅要求对齐 MySQL
group_concat_max_len=512前后协议类型切换\u201d的诉求作为兼容性契约闭环。契约已记录于
mo-test-reports/mysql-compatibility-contract的 GROUP_CONCAT-001,对应文档 PR 为 Ariznawlll/mo-test-reports#33。明确边界:
group_concat_max_len <= 512与> 512时采用 MySQL 的 VARCHAR/VARBINARY 与 TEXT/BLOB 协议元数据切换;Type、Length或 prepared statement 跨该阈值的元数据变化实现该规则;BLOB家族类型码本身不等于二进制语义,必须结合 charset、collation 和 flags 判断。本关闭不豁免任何独立正确性问题:文本 charset/collation/flags 错误、VARBINARY 中 NUL 或非 UTF-8 字节被破坏、截断语义错误,或文本/二进制误分类,仍应作为单独 bug 提交和处理。
当前 issue 没有建立这类语义错误的证据;它建立的是已决定不追求的 size-dependent 元数据差异。因此关闭为 not planned。