You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Compatibility]: JSON constructors serialize YEAR values as strings instead of numbers #28058
MatrixOne serializes a SQL YEAR value as a JSON string, while MySQL 8 serializes it as a JSON number. This changes JSON_TYPE, containment predicates, and any generated/indexed value derived from the JSON document.
Environment
Branch: main
Commit: 95d04586eb80864499d0fde27aeb912b463ae4cd
Deployment: local single-CN MatrixOne
Steps to reproduce
CREATETABLEt (id INTPRIMARY KEY, y YEAR);
INSERT INTO t VALUES (1, 2024);
SELECT
JSON_TYPE(JSON_EXTRACT(JSON_ARRAY(y), '$[0]')),
JSON_TYPE(JSON_EXTRACT(JSON_SET('{}', '$.year', y), '$.year')),
JSON_CONTAINS(JSON_OBJECT('year', y), '2024', '$.year'),
JSON_CONTAINS(JSON_OBJECT('year', y), '"2024"', '$.year')
FROM t;
Actual behavior
MatrixOne returns:
STRING | STRING | 0 | 1
The JSON value is "2024".
MySQL 8 returns:
UNSIGNED INTEGER | UNSIGNED INTEGER | 1 | 0
The JSON value is the number 2024.
Expected behavior
For MySQL compatibility, JSON constructors should represent SQL YEAR values as JSON numbers.
Stability and controls
Reproducer: 3/3 on MatrixOne main through JSON_ARRAY and JSON_SET.
JSON_OBJECT produces the same string representation.
MySQL 8 control consistently produces a numeric JSON value for the same row.
ENUM control: both systems serialize ENUM('medium') as the JSON string "medium"; the difference is specific to YEAR.
Code analysis
pkg/sql/plan/function/func_builtin_json.go handles types.T_year by formatting the value with strconv.FormatInt and returning a Go string. JSON creation therefore emits a JSON string rather than a numeric scalar.
Regression coverage
After a fix, add deterministic YEAR coverage through JSON_OBJECT, JSON_ARRAY, and JSON_SET, including JSON_TYPE and numeric/string JSON_CONTAINS controls.
Automation checkpoint: merged PR #28093 is being validated against current upstream/main 6d44c50. This issue remains open in phase/testing; no terminal tester PASS has been recorded in the current handoff. Please report complete version, environment, scoped scenario results, and terminal PASS/FAIL evidence before any closure decision.
Activity
fix(json): preserve MySQL binary subtype fidelity (#28092)
fix(json): unify constructor value conversion (#28093)
VioletQwQ-0 commentedon Sep 8, 2026
【QA 交接|PR #28093 已合并】
关联合并:PR #28093(merge commit 8836fb4);当前 main=1cfec4c80134adc5640a3bbf1aef7aaa87a45282。
本次范围:JSON_OBJECT、JSON_ARRAY、JSON_SET 及聚合入口对 YEAR 的兼容语义,YEAR 应作为 numeric atom 暴露为 JSON INTEGER,而不是字符串;同时覆盖 NULL、预编译和重绑定路径。
合并后证据:PR required checks 无失败;本地 exact-main CGo 自测因缺少 cgo/libmo.dylib 阻塞,mo-tester 未安装,未宣称本地 PASS。
请在合并版本连续复验构造函数和聚合函数、常量与列值、单 CN 与多 CN、重启/读回以及生成列/索引消费。PASS 标准是 JSON 类型和值与 MySQL 8 一致;FAIL 时请保留 SQL、main SHA、重复轮次和实际/期望结果。
VioletQwQ-0 commentedon Sep 8, 2026
补充 pin:远端 main 已推进到 9f87b62。请以该当前 main 复验;此前列出的合并提交、测试范围和 PASS/FAIL 标准保持不变。该更新不代表 QA PASS。
VioletQwQ-0 commentedon Sep 8, 2026
再次补充 pin:远端 main 已推进到 9cedf6e。请以该当前 main 复验;此前列出的合并提交、测试范围和 PASS/FAIL 标准保持不变。该更新不代表 QA PASS。
VioletQwQ-0 commentedon Sep 8, 2026
Automation checkpoint: merged PR #28093 is being validated against current upstream/main 6d44c50. This issue remains open in phase/testing; no terminal tester PASS has been recorded in the current handoff. Please report complete version, environment, scoped scenario results, and terminal PASS/FAIL evidence before any closure decision.
Ariznawlll commentedon Sep 9, 2026
测试版本
maina9d3b8b857c44f1249e682c91d4d62a914eb7d20原问题验证
验证
YEAR进入 JSON constructor 后是数值而非字符串,并可被数值 containment 正确匹配。Happy Path 覆盖
Unhappy Path 覆盖
白盒验证
不适用:以 JSON 类型及 containment 可见结果验证。
回归测试
suites/14_issue_regression/t/issue_28056_28057_28058_28060_json_constructor_types.test。--record --repeat 3和非 record--repeat 3均通过;PR 共 21/21 用例、321/321 条语句成功。测试证据
object/array/set、数值命中和字符串不命中均重复 3 次。
测试结论
测试通过。
fix(json): preserve MySQL binary subtype fidelity (matrixorigin#28092)
fix(json): unify constructor value conversion (matrixorigin#28093)
fix(json): preserve MySQL binary subtype fidelity (matrixorigin#28092)
fix(json): unify constructor value conversion (matrixorigin#28093)
fix(json): preserve MySQL binary subtype fidelity (matrixorigin#28092)
fix(json): unify constructor value conversion (matrixorigin#28093)