Repository navigation
fix(sql): accept JSON in remaining string functions - #30883
mergify[bot] merged 12 commits into
Conversation
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.
REQUEST_CHANGES on a336d96ce37fd719de4d6cea7b26011828ec77a8 against 060cb430e9ff59e60dc7bdade05758d343516acb.
I read all five changed files and traced overload resolution, SHA2 integer-argument normalization, binder cast insertion, JSON serialization, result metadata and existing executors. Reusing those owners is a reasonable design, and the non-JSON delegation preserves its previous path. However, the chosen implicit VARCHAR cast has two contracts that differ from the required complete visible JSON text: it unquotes strings and limits width. The two verified failures are inline.
Independent checks: the added seven overload subcases plus 16 additional binding/arity/SHA2-domain controls pass. Real SQL challenges fail for escaped JSON strings and a large JSON string; bool, numeric, JSON-null, and binary-prepared valid/invalid/NULL/recovery controls pass. A second public SQL capture confirms all six functions differ on escaped JSON strings and isolates the wide-array truncation. Restoring both and all changed production files to the verified base through a Go overlay confirms the direct JSON calls were rejected there, while the existing text controls retain their results. No production code was edited. Same native inputs and artifact provenance were verified; each owned fixture reached cleanup and terminal exit.
The exact-head CI is green, and the author reports the canonical BVT passing twice. These successes miss the two newly reproduced cases. The production increment is +39/-6 across two files, tests/results +108, docs 0; no additional state machine, cache, executor or protocol is needed for this repair. No earlier human review threads were present. This focused bug fix is exempt from a design-document gate, but its value-preservation invariant is not met.
## What type of PR is this? - [ ] API-change - [ ] BUG - [ ] Improvement - [ ] Documentation - [x] Feature - [x] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: Related to #23010 (closed as not_planned) and the SOUNDS LIKE subitem of #24496. ROW constructors and issue closure are outside this PR. ## What this PR does / why we need it: `SELECT 'Hello' SOUNDS LIKE 'Hallo'` previously failed to parse. Lower the predicate to ordinary `SOUNDEX(left) = SOUNDEX(right)`, using each operand once and retaining existing SOUNDEX type, NULL, binary/text and prepared-parameter behavior. Preserve non-reserved identifiers/implicit aliases and ordinary LIKE. Contextual lookahead uses the authoritative scanner on a copy, including executable comments, with a recursion guard. No new executor, function ID, JSON-to-SOUNDEX change from #30883, or ROW constructor implementation is included. ### Current integration and validation Head `2a3ab5d549805a4cefa1b860b81d9742c2206ac2` normally merges main `00c103b68bd2b39194147508445956f5ece16dda` into `234270c60a57ad93bc47f7b15de6cea3ed2ebe43`; no rebase or force update. The generated parser was the sole conflict and was regenerated from merged grammar, preserving main's JSON_TABLE charset changes and the SOUNDS predicate. Independent AI source review of the exact integrated feature delta found no blocking issue; this is not a maintainer approval or reviewer test rerun. Fresh validation on this head, Linux amd64 / Go 1.27.1, repository native test wrapper: - Forced parser generation: zero conflicts, all 780 existing main token constants unchanged. Complete MySQL parser and facade packages passed with `-count=1`, covering executable comments, aliases, ordinary LIKE, typed nesting, marker order, HIGH_NOT_PRECEDENCE and format/reparse. Scoped vet, configured incremental lint (0 issues), formatting/diff checks passed. - Full `make build NATIVE_BUILD_JOBS=4` passed, binary embeds `2a3ab5d54`. On its fresh SQL/ISCP-ready owned instance, normal mo-tester Soundex/SOUNDS LIKE BVT passed **122/122 twice**, no failed/ignored/abnormal statements. True/false/NULL independent oracles, expressions, prepared reuse, WHERE/CASE, CTAS and canonical view replay are covered. Terminal table/view and probe-schema residue checks were zero. - Real COM_STMT_PREPARE/EXECUTE reuse passed text, NULL, UTF-8 string, numeric type changes and trailing markers, with explicit SOUNDEX equality control and explicit binary-cast control. SHOW CREATE VIEW original-text and information_schema canonical-definition export/replay both passed. - The previously failing `TestDropAccountDuringAsyncIndexInit` passed fresh under **coverage mode** (6.78s test / 7.478s package), including durable registration, held initializer, real DROP rollback and cleanup assertions. Used the same pinned CI helper's 505-test-package / 484-instrumented-package selection, `-short -tags matrixone_test -covermode=set -count=1`, selecting this one test with local `-p 2` and admission pool 2. This is targeted coverage qualification, not the entire hosted 505-package `-p 8` run or a race result. ### Prior CI failure and baseline repair Old head `e1c1311f...` passed hosted required CI run 40441990982; identity-only successor `234270c...` failed coverage job [122118653081](https://github.com/matrixorigin/matrixone/actions/runs/40483078946/job/122118653081) at `async_index_drop_test.go:212`: initializer not observed before the context deadline. No blind rerun was requested. The old baseline lacks upstream [#31237](#31237), already merged as `fe4fc722a2f932d91ed86d3ef9d20f8a689e7cda`. Main refresh brings its registration-side lifecycle marker and existing durable regression, rather than adding a separate ISCP fix. A diagnostic-only local A/B proved missing registration provenance (expected 1, actual 0) and the upstream marker correction passed the complete test. The original failed CI's actual quarantine event has **not** been verified; selected original events establish the timeout before DROP/cleanup, not that historical scheduling interleaving. New-head hosted CI remains separately pending and is not inferred from prior runs or local coverage success. ### Compatibility and remaining limits SHOW CREATE VIEW retains original SOUNDS LIKE text; information_schema VIEW_DEFINITION formats explicit SOUNDEX equality. Before an old-binary rollback, rewrite/remove new-syntax views and application/prepared SQL. No released-binary upgrade, mixed-version execution or deployed QA result is claimed. The first local attempt to reopen an older temporary data root failed with `shard not bootstrapped`; it was preserved and a fresh isolated data root was used for the passing SQL qualification. This is not an upgrade pass. Versioned D1 design received independent AI technical approval at its original revision; the implementation and executable-comment correction received independent AI technical acceptance, followed by this merge-delta source review. GitHub commit attribution has been corrected and CLAassistant reported all committers signed. Ready requests formal upstream review, not merge, auto-merge, deployment, permission expansion or issue closure.
|
mo-bot review · Commit: Review completed. Read the assessment. |
XuPeng-SH
left a comment
There was a problem hiding this comment.
mo-bot review · mo-bot-local · review
Commit: efc8c79efade6d7c04b20de3deaed49b2a27dc60
Assessment: request_changes
Previous JSON escaping and width concerns are resolved. One P2 design issue remains: compatibility-only CONCAT lowering conflicts with the established shutdown-upgrade contract.
Model: gpt-6-astra / xhigh
Session: 01a1869d-820c-7212-9788-aecfb86a4141 · slot 0 · generation 2
- P2
pkg/sql/plan/base_binder.go:9142: Binding a dynamic JSON argument to MD5, SHA/SHA1, SHA2, COMPRESS, QUOTE or SOUNDEX inserts CONCAT solely to support older CNs and reuse its compatibility fence.
Impact: The repository supports shutdown upgrades and explicitly prohibits adding downgraded plans for older peers or extending existing compatibility gates. The PR already implements direct JSON consumers, so this lowering adds a complete intermediate text vector and a second execution path without serving a supported deployment boundary. Remove the compatibility-only lowering and its new fence assertions while retaining the direct JSON implementation, value/metadata regressions and unrelated existing gates.
Evidence: .agents/skills/mo-dev/references/upgrade-compatibility.md:19 and :26 contain these prohibitions and are unchanged from the supplied merge-base. The lowering's stated purpose appears at base_binder.go:9134. evalExpression.go:1889 evaluates child vectors, and function/func_builtin.go:1287 materializes CONCAT's visible text; function/json_string_consumers.go:109 already provides direct JSON handling. This is a policy/design violation with source-established extra work, not a demonstrated production regression.
Validation:
-
Reviewed the complete 12-file delta, all 13 discussion entries and linked issue context; saved review-plan.md and discussion-assessment.json.
-
Isolation preflight and native prerequisite build passed. Focused JSON-consumer tests passed: 13 top-level tests, 71 results including subtests, no failures or skips.
-
Each of the three changed MORPC/cache tests passed 100 race-enabled repetitions.
-
Reconciled retained logs and command/source/exit receipts in validation-audit.json; verified the frozen head, unchanged source, discussion coverage and independent BVT hash expectations.
-
Reused successful frozen-head CI evidence for unit tests, static analysis and BVT coverage.
Limitations:
-
No local SQL-server, restart or end-to-end performance run was performed; author-reported executions lacked locally accessible raw artifacts.
-
The newly added compatibility-fence simulations were not rerun locally after identifying the design conflict. Earlier mixed-version concerns do not establish a supported deployment requirement under the applicable policy.
aunjgr
left a comment
There was a problem hiding this comment.
Request changes on the mixed-version compatibility lowering. The JSON behavior itself is worth fixing; the blocker is the new unsupported old-peer path and its cost. Reviewed the production diff and tests, and reused the passing CI and author validation for this head.
|
mo-bot review · Commit: Review completed. Read the assessment. |
XuPeng-SH
left a comment
There was a problem hiding this comment.
mo-bot review · mo-bot-local · review
Commit: efc8c79efade6d7c04b20de3deaed49b2a27dc60
Assessment: request_changes
The existing P2 compatibility-lowering concern remains open. Earlier JSON escaping and truncation defects are resolved; no additional blocker was identified.
Model: gpt-6-astra / xhigh
Session: 01a1869d-820c-7212-9788-aecfb86a4141 · slot 0 · generation 2
- P2
pkg/sql/plan/base_binder.go:9142: Binding MD5, SHA/SHA1, SHA2, COMPRESS, QUOTE or SOUNDEX with a dynamic JSON argument inserts CONCAT for older-CN compatibility.
Impact: This adds an intermediate text vector and a second execution path for an unsupported deployment mode, despite existing direct JSON-aware consumers. Remove the compatibility-only lowering and its new fence assertions while retaining direct handlers, value/metadata regressions and unrelated existing gates.
Evidence: upgrade-compatibility.md:19 prohibits downgraded plans for older peers; line 26 prohibits extending existing gates. That policy is unchanged from the merge-base. The binder explicitly states its older-CN purpose; evalExpression.go:1889 evaluates the child vector, func_builtin.go:1287 materializes CONCAT text, and json_string_consumers.go:109 already handles JSON directly. This confirms the existing policy/design finding, not an observed production failure.
Validation:
-
Reviewed the complete 12-file delta, all 17 discussion entries, linked issue context and affected owners; saved discussion-assessment.json.
-
Source/policy/diff audit and eight independent hash-fixture checks passed: checks/1793288090377401495-5.json and review-audit.log. Frozen source remained unchanged.
-
The frozen-head CI snapshot reports successful build, UT, SCA, coverage and selected BVT lanes; skipped lanes were not counted as passes.
Limitations:
-
No new Go, race, SQL, restart or benchmark execution; dependent validation stopped at the confirmed design conflict.
-
Prior review and author execution results remain attributed reports; local_validation contains no raw artifacts.
-
Deployed QA acceptance for issue #28905 remains open.
|
mo-bot review · Commit: Review completed. Read the assessment. |
XuPeng-SH
left a comment
There was a problem hiding this comment.
mo-bot review · mo-bot-local · review
Commit: c2e04062ef96f67d4bb8e6de0bb6419ec04cb672
Assessment: approve
JSON escaping and width fixes remain intact, and compatibility-only CONCAT lowering is removed. Prior compatibility concerns are closed under the supported shutdown-upgrade contract. No actionable findings remain.
Model: gpt-6.1-sol / max
Session: 01a1a004-9884-72c0-ad39-f096c4209c4a · slot 1 · generation 0
Validation:
-
Reviewed all 12 changed paths and reconciled all 21 discussion entries.
-
Record and static audits passed; receipts checks/1793691815930096300-2.json and checks/1793691822539076223-2.json match retained logs.
-
Independently checked 24 hash expectations, compression metadata, preserved SQL controls and seven serialized predecessor-expression fixtures.
-
Qualified prior execution evidence against unchanged handlers; frozen-head CI reports successful build, unit tests, static analysis, coverage and multi-CN BVT.
Limitations:
-
No fresh Go, race, SQL or restart tests were run; historical runtime results rely on supplied reports without raw logs.
-
Deployed QA for issue #28905 remains open.
aunjgr
left a comment
There was a problem hiding this comment.
Reviewed all changed code/test/SQL hunks at this head. No actionable correctness finding. The delivered implementation binds JSON directly (TestJSONStringConsumersBindJSONDirectly), renders complete visible JSON bytes inside the consumers, preserves escaped/wide values, SQL NULL versus JSON null, selection masks, non-JSON overload behavior and unbounded/binary result metadata. The persisted fixture test also executes the predecessor CONCAT-wrapped representation, so both representations remain readable under the supported stopped-cluster upgrade contract. Checked the isolated virtual-clock cache fixtures and MORPC reconnect-budget ownership. Reused successful current-head CI and qualifying focused/package/SQL evidence; no new local tests. Non-blocking description correction: the opening/current-behavior paragraphs still describe mandatory CONCAT lowering, whereas this head deliberately removes that lowering and its intermediate vector; please describe the direct implementation in the eventual commit message.
🚫 Left the queue · pull request branch update failed2 h 11 min in the queue, with no time running CI. So far
Reason The pull request can't be updated
To get back in the queue
Requeued — the merge queue status continues in this comment ↓. Times in UTC · dashboard · how the merge queue works |
Bring the reviewed branch up to date for the merge queue.
✅ Merged into
|
What type of PR is this?
Which issue(s) this PR fixes:
Related to #28905. Keep the issue open until deployed QA acceptance.
What this PR does / why we need it:
Support JSON operands in MD5, SHA/SHA1, SHA2, COMPRESS, QUOTE and SOUNDEX. Bind JSON operands directly and render complete visible JSON bytes inside each consumer without inserting a CONCAT expression or intermediate text vector. This preserves quotes, escape bytes and values above 65,535 bytes without a bounded VARCHAR cast. SHA2 integer-argument normalization, non-JSON behavior, ordinary CAST/assignment semantics, SQL NULL versus JSON null, and selection masks remain unchanged. QUOTE/SOUNDEX retain unbounded result metadata; COMPRESS retains its binary result.
Deployment contract: full offline upgrade. Stop the cluster and replace all MatrixOne service binaries before accepting queries or resuming work; every CN must run the new binary. Mixed old/new CN execution and binary rollback are unsupported. The current implementation binds JSON directly. A retained seven-consumer predecessor-expression test replays the earlier CONCAT-wrapped representation under the current execution code; that component test is not an official released-binary upgrade or a live mixed-CN test.
Historical validation and intermediate revisions
The following records describe earlier revisions. In particular, CONCAT lowering and its component benchmarks were superseded by direct JSON binding at the current head; they do not describe the current implementation.
Rebased onto main at
70e48cbef1235a8ef4b6c887cb37b0947bace714. All four original commits are range-diff equivalent. Preserve main's DATE_TRUNC/registry changes and ELT lazy-selection/warning regressions alongside all six-function regressions.The existing frontend cache tests use supported virtual time, preserve value/snapshot assertions, and check valid at TTL minus 1 ns and expired exactly at TTL. Their synchronous checks cannot leave an Eventually predicate racing global-cache restoration. Production cache behavior, timeouts and skips are unchanged.
Validation after rebase, macOS arm64 / Go 1.27.1 with verified native provenance:
-short -count=1. Complete function/planner/compile packages passed-short -race -count=1; both changed frontend cache tests also passed once under race.func_json_string_consumers.sqlpassed 87/87 twice in normal mo-tester comparison on the same SQL+ISCP-ready instance: zero failed, ignored or abnormal statements. This includes escaped/wide JSON, independent hash/compression/QUOTE/SOUNDEX oracles, NULL, prepared execution, views/CTAS, and main's retained ELT/warning controls.gpt-6.1-sol/xhighdesign and final overall source review completed with no material blocker under the accepted offline contract. The abandoned protocol-130 candidate is absent from delivery.The post-rebase increment only documents the deployment requirement; it adds no runtime work. No throughput improvement or full CI result is claimed. Fresh remote CI and deployed issue #28905 QA remain pending.
Local source fingerprints, model receipts and validation logs:
/Users/xupeng/.codex/issue-to-pr/matrixone/pr30883-fix-20261024/.Maintenance update —
620392eac7a93c3ca022e0aaa759a7316f04cc5cThis increment changes only the
TestSendWithCannotConnectfixture. Healthy backend construction now uses the normal bounded setup budget; the original 200ms reconnect budget is applied by the write-loop fault-injection callback immediately before disconnect. The request deadline and post-fault assertions are preserved. A failed Send now terminates the test before closing a possibly nil Future.Current-source validation on macOS arm64 / Go1.27.1:
Three normal-mode trials of the original fixture did not reproduce the hosted incident. Its physical constructor-latency cause remains INCONCLUSIVE; no confirmed-flaky/upstream claim or CI rerun is implied. This test-only increment does not requalify the previously reported full-PR SQL/restart evidence, withdraw the outstanding compatibility review, establish reviewer approval, or complete deployed QA. Fresh checks for this new head are separate and still require verification.
Maintenance update — JSON consumer remote compatibility (
4baac22a69f3dccf068804ca2c2c5496e4eab2a0)Newly bound MD5, SHA/SHA1, SHA2, COMPRESS, QUOTE, and SOUNDEX JSON expressions retain their original overload and result metadata but lower their input through the existing JSON-aware CONCAT operation. This carries the existing protocol-129 source, destination, receiver, and persisted-expression fence; the pre-change base already implements this renderer at version 129. Previously serialized direct-JSON consumer plans remain subject to the stopped-cluster upgrade and rollback restriction above.
Validation on macOS arm64: focused source/destination/receiver and persisted-floor tests passed; the full affected plan, function, and compile packages passed with
-short; configured lint and diff checks passed. The canonical JSON consumer SQL case passed twice, 88/88 each, in an isolated TCP-only embedded cluster, with owned databases removed and cluster close verified. This is not a live mixed-version deployment test.A local component microbenchmark compared direct current-head JSON MD5 with the lowered CONCAT + MD5 route in the same binary (five samples per variant, 300 ms each). Median time increased from 985.7 ns to 1,606 ns for a 16-byte string and from 169,849 ns to 184,206 ns for a 65,536-byte string; median allocation increased from 760 to 1,512 B/op and from 107,272 to 255,480 B/op respectively. These unpaired component measurements include per-call result construction and do not establish distributed query throughput or peak service memory. Raw evidence is retained locally; this cost and the older-plan boundary remain review considerations.
Maintenance update — base integration (
efc8c79efade6d7c04b20de3deaed49b2a27dc60)The Connector/J CI build of the prior head exposed a base-integration compile failure: the merged JSON renderer requires a context argument. Merged main at
792a65bfdad85eafb0eb6a0e441fab73293c41b5and passed the active execution context to the six affected consumer calls. This preserves the base renderer and the compatibility lowering.On the merged content, the full affected function, plan, and compile packages passed
-short, configured lint and diff checks passed, and the canonical SQL case passed twice at 88/88 in an isolated TCP-only embedded cluster, with teardown verified. The single-node SQL result is not a mixed-version or deployed QA result. Fresh remote checks apply to this new head.On the merged source, the same local unpaired component benchmark (five 300-ms samples per variant) had median direct/lowered times of 1,018/1,610 ns for 16-byte inputs and 170,824/184,431 ns for 65,536-byte inputs. Median allocated bytes were 760/1,512 and 107,272/255,480 respectively. These component measurements include per-call result construction and do not measure end-to-end query throughput or service peak memory.