Skip to content

[Compatibility]: JSON_ARRAYAGG rejects YEAR values supported by MySQL #28061

Closed

Description

@Ariznawlll

Description

MatrixOne rejects YEAR input to JSON_ARRAYAGG. MySQL 8 accepts the same column and emits numeric JSON elements. This prevents aggregation of a supported temporal SQL type into JSON.

Environment

  • Branch: main
  • Commit: 95d04586eb80864499d0fde27aeb912b463ae4cd
  • Deployment: local single-CN MatrixOne

Steps to reproduce

CREATE TABLE t (id INT PRIMARY KEY, y YEAR);
INSERT INTO t VALUES (1, 2023), (2, 2024);
SELECT JSON_ARRAYAGG(y) FROM t;

Actual behavior

MatrixOne returns:

ERROR 20301 (HY000): invalid input: unsupported type for json aggregate: YEAR

Expected behavior

MySQL 8 returns a numeric JSON array:

[2023, 2024]

MatrixOne should accept YEAR values and preserve them as numeric JSON elements for MySQL compatibility.

Stability and controls

Code analysis

The JSON aggregate type dispatcher rejects YEAR before value conversion, while scalar JSON constructors have a separate YEAR conversion path.

Regression coverage

After a fix, add deterministic JSON_ARRAYAGG(YEAR) coverage with numeric JSON type assertions and a normal integer aggregation control.

Activity

  1. added this to the MO-202609 milestone on Sep 3, 2026
  2. added
    kind/bug
    on Sep 3, 2026
  3. added theissue type on Sep 3, 2026
  4. added
    severity/s1
    and removed on Sep 8, 2026
  5. removed their assignment
    on Sep 14, 2026
  6. VioletQwQ-0 commented on Sep 14, 2026

    @VioletQwQ-0
    Collaborator

    QA 验收请求

    #28094 已合并,关联 issue #28061 保持 OPEN,现转 QA 验收。

    • 修复 PR:fix(json): preserve arrayagg temporal and year values #28094,PR head 7e10f471f8ff25f813d6c9fd7eecf9f6b1212cd2
    • 合并提交 / 当前 main:afbb411d5d880e1d0bf2a088ab14d81374254565
    • exact-head required CI:PASS;UT、Coverage、Compose/Standalone BVT 相关门禁均通过。
    • 开发侧 BVT:保留 canonical test/distributed/cases/function/func_json_agg.test / .result;本机因缺少 Java runtime 未执行,记为 NOT_RUN。

    请在上述 exact main 上完成:

    1. 执行 canonical BVT,覆盖 JSON_ARRAYAGG 聚合 YEAR 值的成功路径及结果断言。
    2. 与 MySQL 对照 YEAR 值聚合结果、NULL/空集合边界和协议返回结果。
    3. 在目标 QA 拓扑复核执行无错误且结果稳定。

    预期 PASS:YEAR 值可被 JSON_ARRAYAGG 正常聚合,结果与 MySQL 兼容预期一致,且无新增错误或告警。
    预期 FAIL:出现执行错误、结果与 MySQL 不一致,或 canonical BVT/目标拓扑验证不完整。

  7. Ariznawlll commented on Sep 15, 2026

    @Ariznawlll
    CollaboratorAuthor

    测试版本

    • MatrixOne main:0c3a04f390adaf6281fd592a49778ea5b1155e67
    • 本地 standalone(1 CN / 1 TN / 1 LogService),2026-09-15。

    原问题验证

    JSON_ARRAYAGG 当前接受 YEAR,并生成数值 JSON 元素而非拒绝或字符串化错误。

    Happy Path 覆盖

    覆盖多个 YEAR 值聚合和 JSON_TYPE 元数据检查。

    Unhappy Path 覆盖

    覆盖 NULL 与聚合边界,确认不会因 YEAR 类型触发类型转换错误。

    白盒验证

    不适用:公开 JSON 聚合 SQL 路径直接覆盖。

    回归测试

    已加入 MOTR:issue_28061_json_arrayagg_year,见 motr#176。

    测试证据

    新 MOTR 用例连续运行 3 轮成功,YEAR 聚合结果和 JSON 类型断言均正确。

    测试结论

    测试通过。

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

Metadata

Metadata

Assignees

Labels

kind/bugphase/testingseverity/s1

Type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions