Repository navigation
[RFC] JSON_TABLE MySQL 8.0.27+ compatibility design - #28273
Conversation
|
Review repair pushed at The RFC now addresses all six findings: parent-level sibling fallback (0/0, 0/N, N/0, N/M), remapped and remotely transported APPLY predicates, parse-time MySQL 8.0.46 warning 1287 and occurrence counting, CN-independent keyed-once diagnostic merge, fail-closed JSON_TABLE view downgrade handling, and PATH multi-match aggregation/final-cell memory limits. Semantic preflight is PASS for the exact head (diff hash |
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
XuPeng-SH
left a comment
There was a problem hiding this comment.
Design review of exact head 3355849fd4f5085157749a5b926516a5db0f4da9: request changes for one information-loss gap in the proposed diagnostic protocol. This PR is documentation-only; I am not judging absent implementation/tests as defects.
I read the complete RFC and checked the current Apply/terminal diagnostic boundaries and pinned MySQL table-function source. The dedicated AST, final-remap condition encoding, resumable nested iterator, no-match sibling rules, final-cell size bound, explicit view downgrade boundary and serial delivery plan are reasonable. In particular, keeping ON evaluation inside OUTER APPLY is necessary to preserve a left row when all produced right rows fail the predicate. The remaining issue is in the Diagnostics section.
[P1 design] Carry all keyed-once identities independently of bounded retained warning records
The RFC extends the existing terminal envelope with keys on warning_diagnostics, retains the existing bounded warning list, and promises exact deduplication even after that list is full. These pieces are insufficient together. Current remote_warnings.go retains only a bounded prefix while maintaining a separate total; remoterunServer.go:1229 serializes only that retained list, and remoterunClient.go:927-940 forwards the aggregate total plus retained records. Once a remote warning is dropped from the list, attaching a key to the retained records cannot convey its identity to the coordinator.
Counterexample: fill each of two remote collectors with ordinary each-event diagnostics, then have both encounter the same JSON_TABLE statement-once key K. Both terminal totals include K, but neither retained list contains it. The coordinator cannot distinguish “same K on both CNs” from two distinct omitted keys; its seen set cannot recover information that was never transmitted. Blindly summing counts overcounts, while ignoring dropped counts loses ordinary warnings. Retries/intermediate CN forwarding can amplify the discrepancy.
Please freeze a transport/counting contract that separates (a) complete statement-once key presence, bounded by the planned operator/column/diagnostic space, (b) the ordinary each-event count, and (c) bounded presentation records/messages. All once keys must survive retention overflow and intermediate forwarding, including a retry after another fragment has reported K. Define whether failed-attempt ordinary warning counts are committed or discarded and how the terminal merge avoids replay duplication. The coordinator can then union keys, sum the appropriate event counts and independently cap SHOW WARNINGS storage. It need not retain every row-level warning or unbounded payload.
Add to the RFC's required oracles: remote retention already full before K, same versus distinct omitted keys on two CNs, intermediate forwarding, each-event counts mixed with once keys, and retry after a partial terminal merge. This is not a request for runtime tests in this docs PR; it is a necessary protocol decision before implementation can honor the stated warning invariant.
No new implementation was run and no MySQL server differential is claimed. Source checks used the current remote collector/envelope and MySQL 8.0.46 table_function.cc; the claimed behavior of multiple nested paths and multi-match JSON targets is consistent with that reference. This review does not approve future parser/operator changes or assert that the full compatibility corpus has executed.
|
Review repair on exact head
Please re-review this exact revision. |
XuPeng-SH
left a comment
There was a problem hiding this comment.
Re-review of the updated design at 2dc2582. The prior blocking diagnostic information-loss finding is addressed: complete once-key presence, ordinary event counts and bounded presentation records now travel independently. The version/required-field gate prevents legacy totals from silently substituting for missing keys; attempt-scoped provisional ownership, contribution replay identity, terminal completeness and intermediate merging close the documented retry/forwarding paths. Overflow, omitted same/distinct keys, mixed counts and failed-attempt retry now have explicit required oracles.
Read the complete RFC and the delta from 3355849. No remaining design blocker established. Approval applies to this documentation contract, not to absent runtime implementation or a claim that MySQL differential tests have run. Keep the accepted design revision traceable in the implementation series and advance the RFC status through the normal acceptance process.
Merge Queue Status
This pull request spent 13 minutes 4 seconds in the queue, with no time running CI. ReasonPull request #28273 has been merged manually at ba08a03 HintYou were too fast! Tick the box to put this pull request back in the merge queue (same as
|
## What type of PR is this? - [ ] API-change - [ ] BUG - [ ] Improvement - [x] Documentation - [ ] Feature - [ ] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: issue matrixorigin#28036 ## What this PR does / why we need it: This RFC freezes the MySQL 8.0.27+ JSON_TABLE compatibility contract before implementation. It defines the parser and AST surface, versioned plan payload, lazy path iteration, scalar conversion outcomes, nested row generation, correlated APPLY semantics, warning ownership, lifecycle, and the pinned MySQL 8.0.46 differential-test corpus. This is the first serial PR for issue matrixorigin#28036. It intentionally contains no runtime implementation and does not close the issue. Review repair in this revision: - Fixes sibling nested 0/0, 0/N, N/0, and N/M row cardinality and the no-match nested DEFAULT oracle. - Carries correlated APPLY ON predicates through final remap, versioned TableFunction.Param encoding, remote decode, and per-CN execution. - Freezes reverse ON ERROR ... ON EMPTY at parse/prepare code 1287 with the MySQL 8.0.46 message and per-occurrence count. - Defines CN-independent keyed-once diagnostic transport, coordinator merge, bounded retention, and statement lifecycle. - Makes JSON_TABLE views a fail-closed downgrade boundary with restart, old-version read, and drop/replace coverage. - Freezes PATH multi-match JSON aggregation versus non-JSON ON ERROR, the 64 MiB final-cell limit, and allocation-failure cleanup. Validation: - Unit/integration: N/A — documentation-only RFC; the contract is reviewed against the current parser, planner, executor, and pipeline boundaries. - BVT: N/A — the production behavior is introduced by the later implementation PRs; the RFC records the required BVT path. - QA required: yes — the issue remains open until the final implementation PR is merged and QA supplies a version-, environment-, and result-specific PASS. - Base behavior: N/A — this PR adds no executable behavior. - Semantic preflight: PASS — exact head `3355849fd4f5085157749a5b926516a5db0f4da9`, diff hash `3439dbc4a9f5b21282b0d2c6dda6134b8939e71195447ded2abb60487618a356`; six review findings mapped to PASS invariant traces. - PR-head behavior: PASS — RFC is present at the exact pushed head `3355849fd4f5085157749a5b926516a5db0f4da9`. --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
## What type of PR is this? - [ ] API-change - [ ] BUG - [ ] Improvement - [x] Documentation - [ ] Feature - [ ] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: issue matrixorigin#28036 ## What this PR does / why we need it: This RFC freezes the MySQL 8.0.27+ JSON_TABLE compatibility contract before implementation. It defines the parser and AST surface, versioned plan payload, lazy path iteration, scalar conversion outcomes, nested row generation, correlated APPLY semantics, warning ownership, lifecycle, and the pinned MySQL 8.0.46 differential-test corpus. This is the first serial PR for issue matrixorigin#28036. It intentionally contains no runtime implementation and does not close the issue. Review repair in this revision: - Fixes sibling nested 0/0, 0/N, N/0, and N/M row cardinality and the no-match nested DEFAULT oracle. - Carries correlated APPLY ON predicates through final remap, versioned TableFunction.Param encoding, remote decode, and per-CN execution. - Freezes reverse ON ERROR ... ON EMPTY at parse/prepare code 1287 with the MySQL 8.0.46 message and per-occurrence count. - Defines CN-independent keyed-once diagnostic transport, coordinator merge, bounded retention, and statement lifecycle. - Makes JSON_TABLE views a fail-closed downgrade boundary with restart, old-version read, and drop/replace coverage. - Freezes PATH multi-match JSON aggregation versus non-JSON ON ERROR, the 64 MiB final-cell limit, and allocation-failure cleanup. Validation: - Unit/integration: N/A — documentation-only RFC; the contract is reviewed against the current parser, planner, executor, and pipeline boundaries. - BVT: N/A — the production behavior is introduced by the later implementation PRs; the RFC records the required BVT path. - QA required: yes — the issue remains open until the final implementation PR is merged and QA supplies a version-, environment-, and result-specific PASS. - Base behavior: N/A — this PR adds no executable behavior. - Semantic preflight: PASS — exact head `3355849fd4f5085157749a5b926516a5db0f4da9`, diff hash `3439dbc4a9f5b21282b0d2c6dda6134b8939e71195447ded2abb60487618a356`; six review findings mapped to PASS invariant traces. - PR-head behavior: PASS — RFC is present at the exact pushed head `3355849fd4f5085157749a5b926516a5db0f4da9`. --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
## What type of PR is this? - [ ] API-change - [ ] BUG - [ ] Improvement - [x] Documentation - [ ] Feature - [ ] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: issue matrixorigin#28036 ## What this PR does / why we need it: This RFC freezes the MySQL 8.0.27+ JSON_TABLE compatibility contract before implementation. It defines the parser and AST surface, versioned plan payload, lazy path iteration, scalar conversion outcomes, nested row generation, correlated APPLY semantics, warning ownership, lifecycle, and the pinned MySQL 8.0.46 differential-test corpus. This is the first serial PR for issue matrixorigin#28036. It intentionally contains no runtime implementation and does not close the issue. Review repair in this revision: - Fixes sibling nested 0/0, 0/N, N/0, and N/M row cardinality and the no-match nested DEFAULT oracle. - Carries correlated APPLY ON predicates through final remap, versioned TableFunction.Param encoding, remote decode, and per-CN execution. - Freezes reverse ON ERROR ... ON EMPTY at parse/prepare code 1287 with the MySQL 8.0.46 message and per-occurrence count. - Defines CN-independent keyed-once diagnostic transport, coordinator merge, bounded retention, and statement lifecycle. - Makes JSON_TABLE views a fail-closed downgrade boundary with restart, old-version read, and drop/replace coverage. - Freezes PATH multi-match JSON aggregation versus non-JSON ON ERROR, the 64 MiB final-cell limit, and allocation-failure cleanup. Validation: - Unit/integration: N/A — documentation-only RFC; the contract is reviewed against the current parser, planner, executor, and pipeline boundaries. - BVT: N/A — the production behavior is introduced by the later implementation PRs; the RFC records the required BVT path. - QA required: yes — the issue remains open until the final implementation PR is merged and QA supplies a version-, environment-, and result-specific PASS. - Base behavior: N/A — this PR adds no executable behavior. - Semantic preflight: PASS — exact head `3355849fd4f5085157749a5b926516a5db0f4da9`, diff hash `3439dbc4a9f5b21282b0d2c6dda6134b8939e71195447ded2abb60487618a356`; six review findings mapped to PASS invariant traces. - PR-head behavior: PASS — RFC is present at the exact pushed head `3355849fd4f5085157749a5b926516a5db0f4da9`. --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
## What type of PR is this? - [x] BUG - [x] Feature - [x] Test and CI ## Which issue(s) this PR fixes: Related to #28036 QA required: yes. This partial feature must not close the issue. ## What this PR does / why we need it: Preserves the JSON_TABLE G1 conversion/path foundation and adds an executable, serial G2 SQL consumer for the approved RFC in #28273. The consumer connects contextual parser/AST grammar, dynamic-schema binding, correlated APPLY planning, bounded iterator frames, scalar/default conversion, vector output, and existing DATALINK/stage ownership. The supported core includes constant JSON/text input, JSON/text/DATALINK column input, direct and correlated stage-DATALINK, ordinality, typed PATH/EXISTS columns, nested sibling traversal, ON EMPTY/ON ERROR, prepared reuse, and INNER/CROSS correlation with ON/USING/NATURAL predicates preserved. Invalid DEFAULTs fail during binding even for an empty source. Missing/unmatched nested inputs produce NULL-complemented rows, not DEFAULT-filled rows. Warning publication uses the existing attempt-owned sink and occurs at successful batch production, including early LIMIT. One local function occurrence emits at most one warning per truncating column across input/output batches; failed/cancelled attempts discard their pending sink through the existing execution owner. Operators close iterators, release result/executor memory and reset generation state for reuse. JSON_TABLE execution is forced onto one coordinator scope until distributed keyed-once diagnostics have their separate verified contract; input scans may still be remote. This is not complete G3/MySQL compatibility. Correlated LEFT JOIN, reversed policy syntax requiring parse-time diagnostics, and persisted JSON_TABLE views are rejected explicitly. Lossy character and fractional-to-integer conversions whose compatibility policy is not yet accepted also fail closed rather than silently claiming NULL ON ERROR compatibility. Distributed diagnostic identity/transport, full retry/remote terminal accounting, persisted-view upgrade/downgrade and deployment QA remain separate open acceptance gates. ## Validation and evidence ### Current metric-fixture CI repair Current head: `1d4fbab3cad522824c07e083c90c23e71a0e0f3d`. TestExporter now waits for the two actual asynchronous full raw-histogram collector sends before gathering and restoring the global buffer limit. All original four sends, fourteen samples, clock, counter/gauge and capacity assertions remain unchanged. No production JSON_TABLE, kernel or native source changed. PASS on actual Linux/amd64 Go 1.27.1, CPU4/8GiB/no swap: focused normal count5; full owning-package normal and atomic coverage; race probe; focused race count100; full owning-package race. Raw executions, compiler/default-vet evidence, coverage and exact source/native hashes were independently verified by root. Genuine native provenance and actual resolved library closure are verified; unused libmo is not claimed as loaded. Separate golangci-lint and new SQL/BVT execution are not claimed. BVT: N/A for this test-only completion oracle; the full PR retains its canonical JSON_TABLE SQL/result pair and earlier immutable evidence. The independent TestDelete4 CI failure (committed count108 versus value107) remains unresolved. Its bounded exact base/head controls are pending: the first validator stopped at an incorrect unused-libmo loader requirement before executing those tests. This incremental push is not a CI-green, flaky/upstream, full-feature, QA or review-closure claim. No failed-job rerun, thread resolution or re-review is inferred. ### Previous incremental CI-toolchain repair Recorded head: `bd35929c5d53d69dbab9f764430694c3ebaf42a4`. Both source-build Dockerfiles retain the published native SDK and replace Go 1.27.0 with Go 1.27.1 to satisfy the module minimum with local toolchain selection. The before/after regression contract and six existing native-contract tests pass. An owned, resource-capped mo-55 Linux/amd64 container used actual Go 1.27.1 to download the full repository modules without changing go.mod/go.sum (exit 0; no OOM). Both Dockerfiles pass BuildKit checks for amd64/arm64; ARM execution and a new full service-image/BVT run are not claimed. Temporary containers/builders were verified absent. BVT for this incremental setup-only delta is N/A because the failure happens before SQL runtime; the contract and real module container are the relevant regressions. Existing canonical JSON_TABLE BVT and immutable kernel/race evidence below remain separate. The old-head ONNX download HTTP 504 is an independent setup cluster, not diagnosed as flaky. New-head CI and full-feature acceptance remain pending; no blind rerun or review closure is inferred. ### Previous test-only CI repair and validation Recorded head: `f043ab08560754bdcc958983cee83a68f52ee03a`. Fixes the privilege-cache test's content-versus-physical-version oracle; production authorization and JSON_TABLE source are unchanged. The exact two test files over accepted source `a5e592952359f713389caab54d2a7fad34cc7b64` and base `f6c86c9c0452db27af1b0c9aceff1aa5b96aabad` passed eleven normal owning packages, focused physical-version and JSON_TABLE lifecycle race (100 each), full table_function/compile race, isolated mo-50 Linux race (3 focused repetitions plus all 155 issues tests), pinned incremental lint/molint, and a complete supported ARCHSIMD=0 build. Two real canonical JSON_TABLE BVT comparisons passed 73/73 each, with zero failed/ignored/abnormal. SQL database/stage teardown and exact owned local service/Linux container absence were verified. The old physical-token equality expectation has a deterministic counterexample with no catalog row mutation. The original full issues run passed with diagnostic-only logging; the original CI scheduling trigger was not reproduced and is not classified as flaky/upstream. New-head required CI is pending and independent. Full G3/remaining compatibility/distributed diagnostics/persisted-view/deployment QA are not closed by this test-only repair. Complete evidence and hashes are retained in the manual task, with the publication comment explaining the source/native/binary binding and build-mode limit. ### Previous integrated consumer validation Previous integrated head: 2805e60, a normal merge of actual main f6c86c9 after GitHub reported a real conflict. The merge preserves both main's registered plugin coordinator/transaction constraints and JSON_TABLE's serial warning ownership. Parser regeneration retained both grammar sets. Three new planner test constructors were adapted to main's existing test-process owner. PASS for the integrated tree 610e1ed on Darwin/arm64, Go1.27.1: seven complete normal owning packages, affected table_function/compile race and coordinator tests, native preparation and final service build. Two actual unchanged canonical BVT comparisons each passed 73/73, with zero failures/ignored/abnormal; the independent 50-contract oracle passed before/after. SQL database/stage teardown is 0/0 and the exact owned service stopped. This merge used focused affected race, not a claimed full new-main race suite. Executed integrated service SHA256: e425fa9d91fcc95a3bd082109b050c950c159fe28d7d825a0990cd6f98b84c4d; native library SHA256: e2fd2236b49444926de47d8a216c15c7547a8a7df265f89a478d0f5be5bda107. New-head CI and independent review remain pending. The existing fengttt review request is retained, not duplicated; a request does not clear CHANGES_REQUESTED. ### Historical pre-merge consumer evidence Starting head: 882260f. Current consumer commit: d2c5d8d; actual validation base/merge-base: 466eb8f. PASS on the exact final source: six complete normal owning packages (5202 top-level / 9652 nested PASS records), full table_function and compile race suites, and 100 lifecycle race repetitions. Native provenance and final service build passed on Darwin/arm64. Frozen and post-validation Go hashes match; the root independently checked all 21 changed file hashes and reviewed the production/test delta. PASS on the actual final service: two separate canonical SQL/BVT comparison runs, each 73/73 statements with zero failures/ignored/abnormal. An independent finite oracle checked 50 output/error contracts before and after the runs, including empty-result headers, correlated ON/USING/NATURAL results, direct/correlated stage-DATALINK, prepared reuse, early LIMIT/cross-batch warnings, failed-attempt Error without leaked Warning, and quoted PATH/DEFAULT bytes in both SQL modes. Test database/stage teardown counts are zero; the owned service was stopped. Earlier 57-statement BVT is not used for this final delta. The exact locally executed service SHA256 is b9a9a125a3afd44fbaa3ae54c636324b485772da738937535fd4823281edf0a7. Raw logs, command/native/source manifests, both BVT reports and the independent oracle are retained in the task evidence. New-head required CI/SCA and independent review remain pending; no local SCA or deployment PASS is claimed. The existing G1 fixes remain: representation-aware decimal diagnostics, malformed stored JSON and complete decimal-payload admission, explicit timestamp session-location options, bounded traversal/building, and original ownership cleanup. Historical validation belongs to its recorded immutable heads; it is not new-head CI or full-feature acceptance. ## Dependencies and QA Approved design/RFC #28273 describes the staged G1/G2/G3 delivery; referenced approval is not approval of this exact implementation. Real SQL consumer/BVT delivery answers the previously unexecutable examples, but does not claim fengttt has accepted the split or withdrawn any review requirement. Other reviewers' actual diagnostic/iterator requirements and full-feature gates remain in the private per-finding ledger. Ready is preserved. No thread is automatically resolved, no reviewer is automatically re-requested while applicable criteria remain incomplete, and no deployment/CI/merge/issue-closure success is inferred from local tests. --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
What type of PR is this?
Which issue(s) this PR fixes:
issue #28036
What this PR does / why we need it:
This RFC freezes the MySQL 8.0.27+ JSON_TABLE compatibility contract before
implementation. It defines the parser and AST surface, versioned plan payload,
lazy path iteration, scalar conversion outcomes, nested row generation,
correlated APPLY semantics, warning ownership, lifecycle, and the pinned
MySQL 8.0.46 differential-test corpus.
This is the first serial PR for issue #28036. It intentionally contains no
runtime implementation and does not close the issue.
Review repair in this revision:
no-match nested DEFAULT oracle.
TableFunction.Param encoding, remote decode, and per-CN execution.
MySQL 8.0.46 message and per-occurrence count.
bounded retention, and statement lifecycle.
old-version read, and drop/replace coverage.
64 MiB final-cell limit, and allocation-failure cleanup.
Validation:
3355849fd4f5085157749a5b926516a5db0f4da9, diff hash3439dbc4a9f5b21282b0d2c6dda6134b8939e71195447ded2abb60487618a356; six review findings mapped to PASS invariant traces.3355849fd4f5085157749a5b926516a5db0f4da9.