Repository navigation
Description
Description
MatrixOne rejects JSON operands for MIN and MAX, while MySQL defines these aggregates for JSON values using JSON comparison/ordering semantics.
Environment
- MatrixOne: latest official
main, commit07fdd4ae0f80f287b93fc4b525fd296d5617abc7 - Deployment: local standalone launch (isolated Log/TN/CN ports and data directory)
- MySQL JSON aggregation contract: https://dev.mysql.com/doc/refman/8.0/en/json.html#json-aggregation
Reproduction
create table t(id int, j json);
insert into t values
(1,'null'),(2,'false'),(3,'true'),(4,'1'),(5,'"a"'),(6,null);
select min(j), max(j) from t;
select id, min(j) over(order by id rows unbounded preceding) from t order by id;MatrixOne behavior
invalid argument aggregate function min, bad value [JSON]
MAX and the window forms are rejected by the same type check. The behavior reproduced in 3/3 fresh runs.
Controls
ORDER BY jandGROUP BY jalready execute through typed JSON comparison/key paths;GROUP_CONCAT(j ORDER BY id)accepts the same JSON column;- explicit string casting allows MIN/MAX to execute, although string order is only a control and is not a replacement for typed JSON order.
Expected behavior
MIN(JSON) and MAX(JSON) should be accepted and use the same JSON value ordering contract as the engine's typed JSON comparison/sort implementation. Ordinary, grouped/window, View, and CTAS paths should resolve consistently.
Code-path analysis
MinMaxSupportedTypes in pkg/sql/plan/function/list_agg.go excludes types.T_json, although JSON is already supported by key comparison and canonical grouping code. The failure occurs before the executor can apply an ordering rule.
Suggested regression coverage
- JSON null, boolean, number, string, SQL NULL, arrays, and objects;
- ordinary/grouped/window MIN/MAX, DOP 1/>1, partial/final, spill, View, and CTAS;
- consistency with
ORDER BYand documented behavior for nonscalar values.
Duplicate search
Open and closed issues were searched for JSON MIN/MAX, JSON standard aggregates, JSON ordering, and [JSON] binding errors; no matching report was found.
Activity
Ariznawlll commentedon Oct 14, 2026
JSON null versus SQL NULL comparison (2026-10-14)
A mixed-type grouped check confirms the ordering distinction in MySQL 8.0.46:
For group 1, MySQL returns JSON null for
MIN(j)(MIN(j) IS NULL = 0) and JSON string"a"forMAX(j); group 2, containing only SQL NULL, returns SQL NULL for both. MO rejectsMIN(j)at binding withinvalid argument aggregate function min, bad value [JSON].The same local runtime also rejects
MAX(JSON); its aggregate binder source is unchanged in currentorigin/maina53390c57de48ac280249ff0e88831e502e20fb0relative to the tested runtime commit2ce4e58af6f03b943ee288ffad81012766cf830a.XuPeng-SH commentedon Oct 22, 2026
Post-merge QA checkpoint (2026-10-22)
PR #28950 merged at head
3b3dc91df675c8925ac83a4789cd1b78357d4dfb, merge commit4ffaa4ceaef74f7c7272d454b7ed4412ce9a1e62. The JSON MIN/MAX fix and its focused regression coverage are present in the merged change.Pre-merge validation is reported in the PR body: five canonical SQL cases passed twice, six owning packages passed vet, and the latest formal approval is for
529abda180ac0312649bbf04d52fe6a1a20f7b88. The merge only synchronized main after that candidate; the production/test changes were reported unchanged. These are author/reviewer receipts, not tests I independently ran.For the exact merge commit, GitHub returned no workflow runs and a pending commit status with zero status checks. The PR head has a successful Iceberg Connector E2E run, unrelated to this change. This environment has no MatrixOne checkout or Go runtime, so I could not run post-merge tests or live SQL.
The PR explicitly supports full-shutdown upgrades with all nodes on the same release and excludes mixed-version rollout. An older unresolved inline review asks for a different-version remote-partial/stale-destination topology; that behavior is outside the declared PR contract and is not treated as a blocker for this issue. The PR also records a separate strict-metadata diagnostic failure; it remains undiagnosed.
The behavior fix is merged and has pre-merge test/reviewer evidence. I kept this issue open and added
Ariznawlllfor post-merge verification, preserving existing assigneeVioletQwQ-0.Next: tester to run the issue's ordinary, grouped/window, and applicable spill/partial-final JSON MIN/MAX regressions against the merged commit in MatrixOne, then confirm the result here.
fix: support JSON values in MIN and MAX (#28950)
XuPeng-SH commentedon Oct 23, 2026
Consolidated into #28868. The canonical issue now includes this MIN/MAX behavior and the typed JSON ordering acceptance cases, while keeping them distinct from numeric SUM/AVG/VAR/STDDEV coercion. No shared immediate root cause or fix is claimed.