Repository navigation
fix(json): accept numeric keys in json_objectagg - #28331
mergify[bot] merged 4 commits into
Conversation
XuPeng-SH
left a comment
There was a problem hiding this comment.
Reviewed all six changed files. No blocking finding in the scoped numeric-key admission change.
Conventional numeric keys are converted through the existing VARCHAR cast, while the executor, aggregate state and duplicate-key policy remain unchanged. The resolver tests cover signed/unsigned widths, float/decimal domains, retained string types and explicitly excluded special types. The ordinary duplicate test no longer assumes an unordered aggregate's input order; the explicit ROWS-frame window case owns the deterministic last-wins assertion. NULL-key error, prepared explicit/bare casts and grouped controls are included.
This is a code-review approval at this SHA, not permission to bypass the declared Draft hold. #28094 must land, shared aggregate BVT additions must be reconciled, and the resulting head needs current native/mo-tester and QA evidence. Prior unchanged-production resolver/package evidence is reused; I did not run new native tests and do not count the JDK/CGo-blocked attempts as passes. Keep #28032 open through versioned QA.
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: - #28092 and #28093 are merged prerequisites. The cumulative constructor/member-of commits were removed; the remaining history is two ARRAYAGG commits. - Current clean head is based on `main@b7eca64` and is ready for fresh review. The PR is Ready for maintainer review; QA remains a separate acceptance gate. - #28331 (issue #28032) is the next JSON aggregation follow-up and shares `func_json_agg.test/result`; it must wait for this PR, then rebase and replay its numeric-key additions. 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 Approved by: @XuPeng-SH
d6bb9fc to
0015239
Compare
0015239 to
38e4ac1
Compare
|
I repaired the BVT artifact mismatch at the exact PR head The previous run |
Merge Queue Status
This pull request spent 21 seconds in the queue, including 1 second running CI. Required conditions to merge
|
What type of PR is this?
Which issue(s) this PR fixes:
issue #28032
What this PR does / why we need it:
JSON_OBJECTAGGnow admits conventional numeric key expressions (signed and unsigned integers, FLOAT, DOUBLE, and DECIMAL) through the existing implicitVARCHARcast path. The executor still receives string keys, so numeric member-name formatting follows the existing explicitCAST(... AS CHAR)oracle. BIT is explicitly excluded even thoughType.IsNumeric()includes it.Existing string and binary-string key behavior, binary value rejection, NULL-key runtime errors, NULL values, empty input, duplicate-key behavior, and aggregate/window state handling remain unchanged. No protocol, state, or framework changes are included.
Changed files:
pkg/sql/plan/function/list_agg.gopkg/sql/plan/function/list_agg_test.gotest/distributed/cases/function/func_json_agg.testtest/distributed/cases/function/func_json_agg.resulttest/distributed/cases/window/mysql_compat_window_json_arrayagg.sqltest/distributed/cases/window/mysql_compat_window_json_arrayagg.resultDependencies and merge order:
6e5f82f568b1ec3e013e8d4ab9031b2360300b84.8836fb4dc7d3aef02bc59dbec298cc305475069e.afbb411d5d880e1d0bf2a088ab14d81374254565.main; this PR is for issue [Compatibility]: JSON_OBJECTAGG rejects numeric key expressions accepted by MySQL #28032.Publication snapshot:
main:23c8cb676edd4fecd2127ec311b540a5a34211e0d6bb9fc7617d28306a11a7c23e402efed8f5626aValidation status:
GOWORK=off go test -mod=readonly -v -count=1 -timeout 120s -run '^TestJSONObjectAgg(NumericKeyResolution|KeyTypeBoundaries)$' ./pkg/sql/plan/functionGOWORK=off go test -mod=readonly -count=1 -timeout 120s ./pkg/sql/plan/function; the required CGo wrapper gate is reported separately below.GOWORK=off go build -mod=readonly ./pkg/sql/plan/function;GOWORK=off go vet -mod=readonly ./pkg/sql/plan/functioncgo/libmo.dylibandthirdparties/install; no CGo test result is claimed.34913627312has started; UT, SCA, shared build, and coverage jobs are still pending at this snapshot.d6bb9fc7617d28306a11a7c23e402efed8f5626a.git diff --check: PASS.Final-head joint pre-review:
mo-self-reviewandmo-pr-preflight-reviewover the complete six-file diff at headd6bb9fc7617d28306a11a7c23e402efed8f5626a; no unresolved blocking finding remains./Users/violet/Documents/Codex/artifacts/matrixone-pr-pipeline/pr28331-astra-d6bb9fc/review.md; validator:PASS semantic=PASS.23c8cb676edd4fecd2127ec311b540a5a34211e0; currentmainobserved before Ready:f0f61f0bc6852a67447921733f641c7d32c0c25b.QA required: yes. QA should compare against MySQL 8 across scalar, grouped, window/
OVER,ORDER BY/LIMIT, prepared and repeated execution, explicit-cast equivalence, NULL key/value and empty input, rejected BIT/BOOL/ENUM/temporal/JSON/UUID types, binary key/value boundaries, duplicate keys, and single-CN/multi-CN aggregate accounting, partial merge, spill, error, and cleanup paths.Self-review (mo-self-review):
VARCHARcast; the unchanged executor continues to consume string keys. Existing aggregate consumer tests cover accounting, partial merge, spill/restore, error, cleanup, and empty-result behavior; existing window tests cover NULL-key error cleanup and Reset.