Skip to content

[Compatibility]: group_concat_max_len rejects values MySQL clamps or accepts #28667

Closed

Description

@Ariznawlll

Description

MatrixOne does not implement MySQL's assignment contract for the group_concat_max_len system variable at either end of its valid range. Values below the minimum are rejected instead of clamped to 4 with warning 1292, and unsigned values above INT64_MAX are rejected even though MySQL accepts them through UINT64_MAX.

Environment

  • Branch: main
  • Commit: e7d46d6dfb27696211ca828c55e245d3bd1b634d
  • Deployment: local standalone, 1 CN / 1 TN / 1 LogService
  • Oracle: MySQL 8.3.0

Steps to reproduce

select @@session.group_concat_max_len;

set session group_concat_max_len = 0;
show warnings;
select @@session.group_concat_max_len;

set session group_concat_max_len = 3;
show warnings;
select @@session.group_concat_max_len;

set session group_concat_max_len = 9223372036854775808;
show warnings;
select @@session.group_concat_max_len;

set session group_concat_max_len = 18446744073709551615;
show warnings;
select @@session.group_concat_max_len;

Actual behavior

MatrixOne returns ERROR 20101 ... convert to the system variable int type failed for every assignment above. Failed low-value assignments leave the old value unchanged; values above 9223372036854775807 cannot be represented.

Expected behavior

MySQL 8.3.0 behaves as follows:

  • 0, 1, and 3 are accepted as assignments, clamped to 4, and expose warning 1292 (Truncated incorrect group_concat_max_len value).
  • 9223372036854775808 and 18446744073709551615 are accepted and retained exactly.
  • 4, 9223372036854775807, and DEFAULT are accepted by both products and serve as controls.

MatrixOne should apply the same minimum-clamping/warning behavior and support the documented unsigned upper range.

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.
  • Controls: 4, 9223372036854775807, and DEFAULT are accepted by MatrixOne.
  • Failed assignments do not corrupt the session's previous value.

Evidence

  • Reproducer: evidence/group_concat/group_concat_variable_boundaries.sql
  • MatrixOne output SHA-256: ef33c5b0e4a5c97847dab8393f55a5ac7b75430f2e05c02ea374787acbfafca4
  • MySQL output SHA-256: 5c57b112ddb03c0f06cddaace1c1322944a1719a22273a18b272b1324b2f5098

Code analysis

pkg/frontend/variables.go registers group_concat_max_len with InitSystemVariableIntType("group_concat_max_len", 4, math.MaxInt64, false). The signed integer system-variable type rejects out-of-range input rather than applying MySQL's warning-and-clamp behavior and cannot represent the MySQL UINT64_MAX upper bound.

Regression coverage

Add session-variable assignment cases for 0, 1, 3, 4, INT64_MAX, INT64_MAX+1, UINT64_MAX, -1, and DEFAULT, asserting both the stored value and SHOW WARNINGS diagnostics.

Related

Activity

  1. added this to the MO-202609 milestone on Sep 11, 2026
  2. added theissue type on Sep 11, 2026
  3. added
    ai-easy
    on Sep 14, 2026
  4. slyunnn commented on Sep 14, 2026

    @slyunnn

    Regression and extended verification for #28667 (2026-09-14)

    Verification Environment

    • MatrixOne origin/main: 6987fda6c4a13295b8d525706342fc6033094d2e — fix: honor mysql ignore space for built-in functions (#28677).
    • Associated fix: #28727, 2cb541edef91debd2b9b4a7f772bd10df1d0ff8a — fix(frontend): support MySQL group_concat_max_len bounds.
    • Full topology: Log + TN + CN1 + CN2 + Proxy. Endpoints: Proxy 127.0.0.1:6001, CN1 127.0.0.1:16001, CN2 127.0.0.1:16002.
    • Client protocol: MOTR/PyMySQL and MySQL wire protocol; exact MySQL 8.3.0 was the compatibility control.

    What Was Covered

    • OK — 0, 1, and 3 clamp to 4 and report warning 1292.
    • OK — Minimum 4, INT64_MAX, INT64_MAX+1, and UINT64_MAX retain their exact values.
    • OK — Negative -1 is clamped with warning 1292; the session remains usable.
    • OK — DEFAULT restores the session value.
    • OK — Exact MySQL 8.3.0 comparison matches clamping, warnings, and unsigned upper-range values.
    • OK — MOTR recorded on Proxy 6001 with 24/24, replayed twice with 48/48, and passed on CN1 16001 and CN2 16002 with 24/24 each.

    Findings

    The fix applies MySQL-compatible minimum clamping and warning diagnostics while preserving the complete UINT64 range.

    MOTR / BVT Coverage

    • Added suites/14_issue_regression/t/issue_28667_group_concat_len.test and suites/14_issue_regression/r/issue_28667_group_concat_len.result.
    • Independent branch: test/issue-28667-group-concat-len.
    • MOTR commit: ab394f9a3e0f285545c4f210a8e17884f83ca22e (test: add MOTR regression for #28667).
    • The branch was pushed to matrixorigin/motr; no issue-specific PR was created.

    Final Conclusion

    Fixed. No large-data regression is required: system-variable assignment and warning generation are deterministic per session assignment and independent of row count, block/batch boundaries, memory/spill, concurrency, skew, network, or resource scale.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

ai-easyarea/compatibilitykind/bug

Type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions