Skip to content

fix(json): preserve arrayagg temporal and year values - #28094

Merged
mergify[bot] merged 3 commits into
matrixorigin:mainfrom
VioletQwQ-0:codex/28061-json-arrayagg-values
Sep 14, 2026
Merged

mergify[bot] merged 3 commits into
matrixorigin:mainfrom
VioletQwQ-0:codex/28061-json-arrayagg-values

Conversation

@VioletQwQ-0

@VioletQwQ-0 VioletQwQ-0 commented Sep 3, 2026 •

Copy link
Copy Markdown
Collaborator

What type of PR is this?

  • API-change
  • BUG
  • Improvement
  • Documentation
  • Feature
  • Test and CI
  • Code Refactoring

Which issue(s) this PR fixes:

issue #28061

What this PR does / why we need it:

After #28093 merged, this PR is rebased onto the current main and contains only the independent JSON_ARRAYAGG delta. It routes TIME, DATETIME, and YEAR inputs through the shared typed conversion: TIME and DATETIME retain their ByteJson kinds with six fractional digits, YEAR is numeric with public JSON type INTEGER, and DISTINCT continues to hash the original SQL vector.

Regular construction, allocation preflight, accounted append, merge, and spill reload use the same atom representation and encoded size. Coverage includes regular/accounted equality, state-free preflight, one-byte-short allocation failure, partial merge, spill save/reload, NULL, DISTINCT, and prepared YEAR.

Dependency and merge order:

QA required: yes — issue #28061 remains open until exact-version, MySQL comparison, and topology tester evidence completes.

Production terminal covered by automation: JSON_ARRAYAGG TIME/DATETIME/YEAR, NULL, DISTINCT, prepared YEAR, regular/accounted/preflight, merge, spill, and allocation failure.

Remaining QA: exact MySQL 8 comparison, single/multi-CN, timezone and persisted-read scenarios; TIMESTAMP timezone and binary/BIT/geometry ARRAYAGG admission remain explicit follow-up scope.

Validation at exact local head aed3f36ba927b46b10485ce1a45c448ca5ac76ec (base b7eca642ce9b6a4c2ebeca3be378d016d19ff9c1):

  • GOWORK=off go list/build/vet -mod=readonly ./pkg/sql/colexec/aggexec: PASS
  • Focused mo-cgo-test ARRAYAGG set (6 tests): PASS
  • Full mo-cgo-test -count=1 ./pkg/sql/colexec/aggexec: PASS
  • Semantic preflight schema v7: PASS semantic=PASS, diff 8277dd6ce07a3fbfb69034e19817bceccf1946a7a6642e6d88372b676d8d0f9b
  • Canonical BVT test/distributed/cases/function/func_json_agg.test/result: retained; local execution is pending because this host has no Java runtime. CI/QA remains the acceptance gate.
  • git diff --check: PASS

@matrix-meow matrix-meow added the size/XL Denotes a PR that changes [1000, 1999] lines label Sep 3, 2026
@mergify mergify Bot added the kind/bug Something isn't working label Sep 3, 2026
@VioletQwQ-0
VioletQwQ-0 force-pushed the codex/28061-json-arrayagg-values branch from 14fe578 to 222a35f Compare September 4, 2026 03:53
@VioletQwQ-0
VioletQwQ-0 force-pushed the codex/28061-json-arrayagg-values branch from 222a35f to 69ffc89 Compare September 4, 2026 05:05
@XuPeng-SH
XuPeng-SH force-pushed the codex/28061-json-arrayagg-values branch from dcc81a5 to a1a7957 Compare September 7, 2026 23:28
XuPeng-SH added a commit that referenced this pull request Sep 8, 2026
## What type of PR is this?

- [ ] API-change
- [x] BUG
- [ ] Improvement
- [ ] Documentation
- [ ] Feature
- [ ] Test and CI
- [ ] Code Refactoring

## Which issue(s) this PR fixes:

issue #28056
issue #28057
issue #28058
issue #28060

## What this PR does / why we need it:

Add a shared resolved-SQL-value converter for JSON_OBJECT values,
JSON_ARRAY values and JSON_SET values. The foundation PR #28092 is
merged; there is no remaining unmerged parent dependency.

Temporal values use six fractional digits. TIMESTAMP uses the session
timezone and retains the DATETIME atom kind. YEAR becomes a numeric atom
whose public JSON type remains INTEGER. Binary values use MySQL tags;
GEOMETRY follows the WKB-to-GeoJSON cast path and invalid WKB remains an
error. Constructor BIT uses tagged TpCodeBlob type16 while CAST(BIT AS
JSON) retains its legacy representation. Prepared numeric/boolean
provenance, SQL NULL and JSON_OBJECT member-name conversion remain
intact.

This maintenance update also closes the current-head binary-domain
compatibility finding:

- JSON constructor and `MEMBER OF` now share concrete binary subtype
conversion: `BINARY=254`, `VARBINARY=15`, and `BLOB=252`.
- Concrete prepared binary metadata takes precedence over the
metadata-free legacy binary-string path, and the admitted
`MOProtocolVersion` is threaded through the conversion.
- BIT constructor values retain tagged type16 representation, prepared
BIT width rejection remains unchanged, and NULL/nonmatch/large-array
behavior is covered.

Validation for `2fd4392ddf1b7d1c5c2e7c03e07581637103b2c8`:

- Fixes the direct prepared JSON_ARRAY_APPEND omission, alongside the
existing ARRAY/OBJECT/SET/INSERT/REPLACE handling. Only modifier value
slots retain concrete types; documents, paths and member names retain
existing conversion.
- The new actual COM_STMT_EXECUTE packet/planner regression fails on
parent 5a7ecd5 and passes with this change at protocol 51/52, including
NULL and rebinding. ARRAY_APPEND's SQL NULL behavior is preserved.
- Stable-content controlled CGo frontend/plan/function packages, rebuilt
service, package vet and diff-check pass. Committed patch matches the
tested working diff byte-for-byte.
- Canonical BVT: ARRAY/OBJECT/SET/TYPE/UNQUOTE/binary MEMBER
OF/ARRAY_APPEND, 312 assertions pass. Real Connector/J
ServerPreparedStatement socket tests separately pass 30 terminal
assertions across six constructors. Socket current-protocol results are
distinct from fixture protocol-51 checks.
- Whole-diff semantic review: PENDING. The prior generated overall PASS
is withdrawn. New-head CI, reviewer decisions and QA remain separate
gates.
- Reproducible evidence and current correction:
#28093 (comment)

BVT: the complete PR extends canonical `.sql/.result` files for the
functions above. The new ARRAY_APPEND BVT checks typed BLOB and SQL
NULL; the frontend packet regression captures the direct prepared
defect.

Downstream dependency and merge order:

- #28094 consumes this PR's shared converter and must not merge before
#28093. It remains a cumulative stack until it is rebased after this PR
merges.
- #28032 is a later follow-up and must wait for #28094 because it
updates the same canonical `func_json_agg` BVT files; its branch must be
rebased after #28094 merges.
- Required order: #28092 (merged) → #28093 → #28094 → #28032.
- After any head update, re-read the exact head and rerun the required
checks before merge.

QA required: yes — exact MySQL 8 comparison, single/multi-CN, binary
prepared protocol, timezone, restart/readback, generated-column and
index scenarios remain formal tester gates. Ready for review does not
mean QA or CI is complete.


### Evidence correction — 2026-09-08

Evidence correction (2026-09-08): the whole-diff semantic PASS
previously reported here is withdrawn. The manifest generator copied
expected results into observed results and set PASS unconditionally; the
validator checked declarations and coverage structure, not their truth.
Individual executable results are separate evidence and are being
checked against their exact content and test assertions. Overall
semantic review is PENDING. This correction does not claim that all
tests were invalid or that the code repair failed. Current-head CI,
reviewer approval and applicable design/QA gates remain separate.

---------

Co-authored-by: XuPeng-SH <[email protected]>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
@VioletQwQ-0
VioletQwQ-0 force-pushed the codex/28061-json-arrayagg-values branch from a1a7957 to 6e05794 Compare September 8, 2026 15:31
@matrix-meow matrix-meow added size/M Denotes a PR that changes [100,499] lines and removed size/XL Denotes a PR that changes [1000, 1999] lines labels Sep 8, 2026
@VioletQwQ-0
VioletQwQ-0 force-pushed the codex/28061-json-arrayagg-values branch from 6e05794 to aed3f36 Compare September 8, 2026 15:48
@qodo-code-review

Copy link
Copy Markdown

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

@mergify

mergify Bot commented Sep 14, 2026 •

Copy link
Copy Markdown
Contributor

Merge Queue Status

  • ✅ Entered queue — 2026-09-14 20:13 UTC · Rule: main · triggered by rule Automatic queue on approval for main
  • 🚫 Left the queue — 2026-09-14 20:18 UTC · at 06defb71376bd1a6235489eb7667e06deb98198b

This pull request spent 4 minutes 22 seconds in the queue, with no time running CI.

Reason

The pull request #28094 has been manually updated

Requeued — the merge queue status continues in this comment ↓.

@mergify

mergify Bot commented Sep 14, 2026 •

Copy link
Copy Markdown
Contributor

Merge Queue Status

  • ✅ Entered queue — 2026-09-14 21:10 UTC · Rule: main · triggered by rule Automatic queue on approval for main
  • ✅ Checks skipped · PR is already up-to-date
  • ✅ Merged — 2026-09-14 21:10 UTC · at afbb411d5d880e1d0bf2a088ab14d81374254565 · squash

This pull request spent 19 seconds in the queue, including 1 second running CI.

Required conditions to merge

This branch was previously deployed

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

Labels

kind/bug Something isn't working size/M Denotes a PR that changes [100,499] lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants