Skip to content

feat(json): implement JSON_SEARCH compatibility - #30833

Open
VioletQwQ-0 wants to merge 32 commits into
matrixorigin:mainfrom
VioletQwQ-0:codex/issue-28033-json-search-20261011
Open

VioletQwQ-0 wants to merge 32 commits into
matrixorigin:mainfrom
VioletQwQ-0:codex/issue-28033-json-search-20261011

Conversation

@VioletQwQ-0

@VioletQwQ-0 VioletQwQ-0 commented Oct 22, 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:

Partial implementation for issue #28033. This PR implements JSON_SEARCH; JSON_MERGE, JSON_DEPTH, and JSON_ARRAY_INSERT were delivered by merged PRs #28329, #28962, and #29519. This PR does not close the umbrella issue.

What this PR does / why we need it:

Implementation

  • Register JSON_SEARCH(doc, one_or_all, search_str[, escape[, path ...]]) with append-only function ID 641.
  • Search the selected ByteJSON subtrees with LIKE matching under the collation resolved from the coercible JSON leaf, search pattern, and supplied escape. JSON string leaves use coercible utf8mb4_bin, which wins a tie with a coercible case-insensitive pattern. Return concrete paths, deduplicate overlaps, and emit JSON-escaped member names that can be used by JSON_EXTRACT. Array selectors such as last resolve to numeric locations in the result. Return quoted member names when the search grammar or the legacy path lexer requires quotes, so the returned path keeps the original key.
  • Preserve prepared argument types and binary provenance. Use byte-wise matching when LIKE resolves to the binary charset. Accept binary mode and escape strings, and validate binary JSON paths only when their rows reach path parsing. Convert numeric, Boolean, and supported temporal search patterns to text for direct and prepared calls, with Booleans represented as 0 and 1. Convert scalar paths to text only when their row reaches path parsing. Search only JSON string leaves. Explicit escapes must be constant. Convert numeric and Boolean escapes to text before checking their length. The omitted escape follows the execution SQL mode.
  • Support the function in views under the current shutdown-upgrade model. Reject it in persisted column, check, partition, and subpartition expressions.

Current validation at 2525574b7a00

  • Addresses the formal review on 038c2c4db43d. Single-weight text matching uses a constant-scratch LIKE matcher with bounded retries. The standalone matcher is proposed in feat(collation): add a constant-space rune LIKE matcher #33758 and the same matcher source is included here for integration testing. The legacy JSON path parser keeps its earlier whitespace and unquoting rules while JSON_SEARCH accepts its own path syntax.
  • On personal Ubuntu, the collation and ByteJSON packages passed under the race detector. Focused JSON_SEARCH race tests passed in function execution, the planner, and colexec. The service build passed.
  • The JSON_SEARCH SQL fixture passed 172/172 through the MySQL protocol on an isolated Ubuntu CN with JDBC metadata comparison disabled. New cases verify legacy key selection and extraction through a returned search path.
  • git diff --check passed. Local preflight found no protected contract changes and a clean merge against main 461c848d7f8e. GitHub CI and formal rereview are pending.

Previous validation at 038c2c4db43d

  • Rebased onto main edd86400a89a. The patch against main is byte-for-byte identical to the previous patch. git diff --check passed.
  • The previous CI run failed in TestManualMergeRetryChecksRecoveredHeadroomBeforeDeadline. The test can check the reservation before the scheduler finishes admitting the task. This PR does not change the merge scheduler or that test.
  • GitHub CI and formal rereview for this revision are pending.

Previous validation at 7276acc65742

  • Addressed the computed binary escape review finding. The binder now uses the escape expression's string type together with literal provenance. A computed binary escape accepts one byte, including 0xFF. Text escapes still accept one Unicode character.
  • The new planner regression reproduced the failure on 90eb902a97e3 and passed on this revision. Focused JSON_SEARCH tests passed in ByteJSON, function, planner, and colexec on Ubuntu.
  • BVT: test/distributed/cases/function/func_json_search.sql passed 170/170 through MySQL protocol in an isolated Ubuntu single-CN cluster with JDBC metadata comparison disabled. The new case proves that a computed 0xFF escape matches a literal percent sign and returns "$[0]".
  • Both scheduled multi-CN BVT jobs passed. Required CI failed on the storage merge unit test described above.

Previous validation at 90eb902a97e3

  • Updated the JSON_SEARCH registry entry and its test to use ID 641 after a cross-branch ID collision. The ByteJSON test helper now uses the package's standard receiver name.
  • GitHub CI for this revision passed. Required CI, the shared build, x86 unit tests, ARM64 static analysis, changed-code coverage, and both scheduled multi-CN BVT jobs passed. Formal rereview is pending.

Previous validation at c4e70a48383c

  • Added executor regression tests for JSON_SEARCH on selected rows. They check lazy evaluation of computed mode, path, and pattern arguments, precedence of earlier errors, and executor reuse.
  • The new colexec tests passed under -race on personal Ubuntu. The unchanged production sources and BVT cases preserve the two successful BVT results from the preceding head.
  • The preceding CI run measured changed-code coverage of 440/611 (72.01%) against a strict 75% threshold. Replaying the same parser on its four profiles reproduced that result. Including the new local test profile gave 499/611 (81.67%). The official coverage job for this head passed with 531/611 (86.91%). Both scheduled BVT jobs passed. Required CI and formal rereview are pending. The preceding ARM64 static-analysis runner also disconnected.

Previous validation at 876c54b56fef

  • Rebased onto upstream main c13851c20654 after the ARM64 runner disconnected and a coverage worker failed admission before checking out the PR. The previous commit passed the x86 unit tests and both scheduled BVT jobs. Previous workflow
  • The patch relative to main is byte-for-byte unchanged. The resulting tree matches a clean integration of the previous head with current main, and git diff --check passed. The updated base includes dependency changes. Required CI and formal rereview for the new head are pending.

Previous validation at 493d0a14a3ce

  • Addresses the formal review on 6041bc364219. JSON_SEARCH reserves matched-path scratch and retained paths through the result's allocation owner. A JSON-typed path is converted only when reached, preserving SQL NULL and path-error ordering. Unquoted paths accept the additional ECMAScript identifier characters, and both document validation and search select the document parser once per batch.
  • Focused race tests passed on personal Ubuntu for ByteJSON, function execution, the planner, and accounted expression evaluation. Regression controls using the previous implementation reproduced the uncharged temporary paths, JSON path type rejection, and Unicode path rejection.
  • BVT: test/distributed/cases/function/func_json_search.sql passed 169/169 through the MySQL protocol in an isolated Ubuntu single-CN cluster with JDBC metadata comparison disabled. The new SQL cases cover JSON-typed SQL NULL paths, short-circuiting, invalid converted paths, and Unicode member names.
  • git diff --check passed. Required GitHub CI and formal rereview are pending.

Previous validation at 6041bc364219

  • Pushed an empty commit to retrigger GitHub Actions after the rebased head bd6def6ff754 received no MatrixOne ALL CI run. The tracked file tree is identical to that head, which includes the upstream CHECK fixture correction from test(sql): align ODKU CHECK cases with input validation #33691. git diff --check passed.
  • Required CI and formal re-review are pending on this head.

Previous validation at bd6def6ff754

  • Rebased onto upstream main faafdf4fef03 to include test(sql): align ODKU CHECK cases with input validation #33691, which corrects the CHECK constraint fixture implicated in the previous proxy BVT failure. The rebase matches the mechanical integration tree. The PR diff against its target is byte-for-byte identical, and git diff --check passed.
  • The only changes from 0c5dd8db89d2 are upstream check_constraint.test and check_constraint.result. The prior focused race tests, service build, and 164/164 JSON_SEARCH SQL checks apply to the unchanged production and feature test files.
  • Required CI, including confirmation of the CHECK fixture, and formal re-review are pending on this head.

Previous validation at 0c5dd8db89d2

  • Rebased onto upstream main d96cdf0c26fd after the arm64 static-analysis runner lost communication with GitHub. The rebased tree matches the merge of the previous PR head and this target. Only the upstream Iceberg test differs from 2a76b3bf6d91. No JSON_SEARCH production or test files changed. The previous focused race, service build, and 164/164 SQL evidence therefore applies to the unchanged JSON_SEARCH files.
  • Proxy BVT on 2a76b3bf6d91 reported three failures in the CHECK constraint fixture. Plain main d96cdf0c26fd reproduced the same three failures after the duplicate-key INSERT validation change in fix(sql): validate offered rows before ODKU arbitration #33687. Coverage could not produce a verdict from the failed run.
  • Required GitHub CI and formal re-review are pending on the rebased head.

Previous validation at 2a76b3bf6d91

  • Rebased onto upstream main at f0c32a66b1cc after the previous arm64 static-analysis runner lost communication with GitHub. The upstream registry keeps MO_IVF_EXACT_RANKABLE at 638 and NOT_NULL_ASSERT at 639. JSON_SEARCH uses 640, with the registry end marker at 641.
  • Compared the rebased tree with integration of the previously published head and this base. The only differences from the mechanical merge were the resolved function registry files. Focused race tests and the service build passed on personal Ubuntu.
  • BVT: test/distributed/cases/function/func_json_search.sql passed 164/164 on this head using mo-tester in an isolated Ubuntu cluster with JDBC metadata comparison disabled.
  • Required GitHub CI and formal re-review are pending on this head.

Previous validation at 8f7f37664851

  • Addresses the formal review on 79aa769b3c93. JSON_SEARCH validates the constant escape in its source character set before passing it to the binary or text matcher. Traversal retains borrowed member names and indices and renders a location only after a string matches. The rendered scratch buffer is reserved before allocation when the query has an allocation account. NULL scalar mode/path rows skip the cast window and result allocation.
  • The two new SQL probes failed on 79aa769b3c93 and passed on this head. BVT: test/distributed/cases/function/func_json_search.sql passed 164/164 on the personal Ubuntu host using an isolated cluster and mo-tester with JDBC metadata comparison disabled.
  • The service build and focused race tests passed on Ubuntu. The tests exercised escape conversion, bounded/charged path rendering and release, nullable scalar modes/paths, and function registration.
  • Required GitHub CI and formal re-review are pending on this head.

Previous validation at 79aa769b3c93

  • Merged upstream main at 6302cd4e33f0. Its new MO_IVF_EXACT_RANKABLE keeps ID 638. JSON_SEARCH moves to the next available ID (639), and the registry end marker advances to 640.
  • On the personal Ubuntu host, the function registry, IVF rankability, JSON_SEARCH traversal, binding and persisted-expression checks passed with the race detector. The integrated service built successfully.
  • BVT: test/distributed/cases/function/func_json_search.sql passed 162/162 against an isolated Ubuntu MatrixOne cluster via mo-tester. JDBC metadata comparison was disabled.
  • Required GitHub CI and formal re-review are pending on the new head.

Previous validation at 8487c763572c

  • Addresses the formal review on 42c571ecd29c. Recursive filters keep reachable path positions only for the current document depth. Match admission uses the encoded byte limit, with temporary match storage charged to the query account when present. Binary JSON is written directly to the result vector.
  • Masks computed arguments after a NULL mode or an earlier NULL path, and validates earlier paths before executing later expressions. Retains the constant escape diagnostics. BIT patterns use their declared byte width and byte order. Matcher selection and mode/path type dispatch are bound before iterating over the batch.
  • Focused race tests covered traversal, result sizing and cleanup, BIT patterns, and binding. The full colexec package passed with the race detector. The service built with this commit integrated into main at acbd597a268e. Preflight and diff checks passed.
  • BVT: test/distributed/cases/function/func_json_search.sql passed 162/162 through the MySQL protocol against an isolated Ubuntu MatrixOne cluster using mo-tester with JDBC metadata comparison disabled. The new cases cover skipped computed paths, preceding invalid path errors, and width-preserving BIT matching.
  • Required GitHub CI and formal re-review are pending on this head.

Previous validation at 42c571ecd29c

  • Head 42c571ecd29cc60a4b93e69e69cadd3d2d5b948a rebases the published c7cbccbd1497 branch onto target main 85c458ac7b94d7f512087a93ff476e2a9486b49f after a CMake download timeout prevented its Ubuntu CI job from starting tests. The rebased file tree matches the clean integration of the prior PR head with that main revision.
  • That exact file tree passed focused race-enabled tests for JSON_SEARCH and its path traversal in bytejson, function evaluation, and planning on the personal Ubuntu host. The full colexec package passed with the race detector enabled. The service build passed.
  • BVT: test/distributed/cases/function/func_json_search.sql passed 155/155 with mo-tester against the integrated service. The tester used the existing setting with JDBC metadata comparison disabled. A binary-protocol probe also verified temporal patterns and prepared path reuse.
  • Required GitHub CI passed. The formal review raised the findings addressed above.

Previous validation at c7cbccbd1497

  • Corrects remaining JSON_SEARCH collation, scalar-argument, and evaluation-order cases. Equal-rank binary escape inputs select byte-wise matching. Explicit collation remains authoritative. SQL NULL documents skip computed mode expressions while preserving diagnostics from explicit escapes for the rows on which the call runs.
  • JSON-typed patterns use MatrixOne's SQL JSON serialization. This preserves the quotes around JSON string values. Object patterns follow MatrixOne's canonical key order and can match a different string from MySQL's length-first key order.
  • Full Go package tests passed for pkg/sql/plan/function, pkg/sql/plan, and pkg/sql/colexec. The candidate's distributed SQL fixture passed 155/155 with JDBC metadata comparison disabled. Prepared statements retained the expected collation behavior and remained reusable after an execution error.
  • A mixed-row CASE probe produced the expected path and NULL results and exactly two warnings 1292 on both the baseline and candidate. Independent Astra High review passed at this commit.

Previous validation at b636b4771b65

  • Head b636b4771b65844a6740765f44693239ffc20353 addresses both findings in the latest review. An isolated Ubuntu service reproduced the DATE-pattern rejection and both NULL-row numeric-path rejections on 572abdfec79f.
  • On the candidate service, DATE, TIME and DATETIME patterns matched JSON strings. A NULL document, mode, or earlier path skipped a later numeric path. An evaluated numeric path returned the expected invalid-path error. The binary-protocol probe also verified a parameter cast to DATE and statement reuse across NULL, an invalid numeric path, and a valid string path.
  • BVT: test/distributed/cases/function/func_json_search.sql passed 137/137 with mo-tester on Ubuntu. The tester used the existing setting with JDBC metadata comparison disabled.
  • Focused JSONSearch tests passed with -race in pkg/sql/plan/function and pkg/sql/plan. The service build and focused tests passed after a local merge with main at f9d52a3a39ed. Preflight and diff checks passed.
  • Required GitHub checks and formal re-review are pending on this head.

Previous validation at 572abdf

  • Head 572abdfec79f6f1dc97c53130a37747d2ed129a8 addresses the latest review. An isolated Ubuntu service reproduced the reported SQL outcomes on 78ee2aada540.
  • The candidate service returned the expected paths for case- and accent-insensitive escapes and valid binary mode and escape arguments. It returned SQL NULL before parsing binary paths on NULL document and mode rows, while an evaluated binary path still returned error 3144. A binary-protocol probe exercised prepared mode, path and pattern arguments.
  • BVT: test/distributed/cases/function/func_json_search.sql passed 130/130 with mo-tester against the candidate service on Ubuntu. The tester used the existing setting with JDBC metadata comparison disabled.
  • Focused JSONSearch tests passed with -race in pkg/sql/plan/function and pkg/sql/plan. The service build and focused tests passed after a local merge with main at 32ffdd4ac272. The preflight and diff checks passed.
  • Required GitHub checks passed. The next formal review raised the two compatibility findings covered above.

Previous validation at 78ee2aa

  • Head 78ee2aada5404862a3024124e84ee01355bd6197 addresses the binary-pattern, Boolean-pattern, and numeric-escape findings in the latest review. An isolated Ubuntu service reproduced all three failures on 25c62f68ecc6.
  • Focused JSONSearch tests passed in pkg/sql/plan/function and pkg/sql/plan on the candidate and on the local merge with main at cb2309da97c3. The preflight and diff checks passed.
  • BVT: test/distributed/cases/function/func_json_search.sql passed 121/121 with mo-tester against the candidate service on Ubuntu. The tester used the existing metadata comparison setting with JDBC metadata disabled. A separate SQL driver probe checked the expected column names, rows, and errors for all 121 statements and reused one binary-protocol prepared statement across binary patterns and NULL.
  • Required GitHub checks passed. Re-review raised the three compatibility findings covered above.

Previous validation at 25c62f6

  • Head 25c62f68ecc6f4a749bf543e235673adf3ec47e8 addresses the pattern collation and numeric pattern findings.
  • Focused JSONSearch tests passed in pkg/sql/plan/function and pkg/sql/plan on Ubuntu. The merge-tree check against main and git diff --check passed.
  • An isolated Ubuntu service matched all 110 statements in test/distributed/cases/function/func_json_search.sql against the expected column names, rows, and SQL errors. The direct SQL check did not compare JDBC metadata. An additional binary-protocol probe verified numeric argument binding and statement reuse with text.
  • GitHub CI and re-review are pending on this head.

Previous validation at b89fda9

  • Head b89fda934e0fd6ad12035975960ecdcf72060667 with target baseline 6674873fdfde80667c96970cefac94bca444de17. Independent Astra High re-review passed on this candidate.
  • Full pkg/container/bytejson, pkg/pb/plan, pkg/sql/plan/function, pkg/sql/plan, and pkg/sql/compile package tests passed with vet enabled. The exact-head service build and PR diff check passed.
  • test/distributed/cases/function/func_json_search.sql passed 98/98 in each of two runs against the exact binary. The tester retained the historical JDBC metadata comparison setting. The case checks concrete path results, legacy key updates, rejected DDL with zero catalog rows, and prepared reuse across SQL mode changes.
  • A live binary prepared probe checked text results, integer and BLOB rejection, NULL, and reuse after errors. The valid warning-producing escape returned the expected path and retained the conversion warning in SHOW WARNINGS. A stored VIEW returned its expected path after restart. Catalog residue checks and isolated service shutdown passed.
  • MySQL 8.0.45 compatibility was checked against its source. That revision used the case-sensitive SEARCH comparator and the concrete-path conventions above.

QA required: yes

The automated checks exercise SQL, the binary protocol, and retained VIEW readback. Broader client and deployment QA remains applicable to this partial umbrella issue implementation.

Earlier draft evidence

Historical validation (bound to the revisions listed below):

  • Exact tested content head: a13f9246b9 (merge of main b01e952ad1 into the feature branch, resolving the function-id and MORPC-version collisions described above with focused re-validation).
  • Base 6cbe375b49696021d72778baa292a66287f080bd: JSON_SEARCH failed with ERROR 20105: not supported; JSON_DEPTH and SELECT 1 controls passed.
  • Candidate binary: make build on head a13f9246b9 (embedded CommitID matches), Go1.27.1-X:simd.
  • Canonical BVT: test/distributed/cases/function/func_json_search.sql passed 56/56 twice on the head binary (0 failed, ignored, or abnormal).
  • Owning packages: pkg/container/bytejson, pkg/pb/plan, pkg/sql/plan/function, and pkg/sql/plan passed.
  • Focused binder/protocol tests on head: PASS — constant escape, NBE empty escape, prepared reuse/rejection, wire round trip, VIEW admission floor rejection at v134 with protocol version 136 and admission at v136, and generated-column rejection; pkg/pb/plan full package PASS including the function-identity scan renumbered to 620; function-id registry consistency PASS.
  • Static checks: go vet, configured incremental golangci-lint, gofmt, and git diff --check passed.

SQL semantic and main-integration repair at 5a94a5b

  • Search each explicit path-selected subtree, including objects, arrays, root and overlapping paths; a single matching path is returned as a JSON string for both one and all. Multiple matches remain a deduplicated JSON array. MySQL 8.0.45 source is the independent oracle.
  • Reproduced both counterexamples on old head 27829c66f9 with focused tests; the integrated repair passes 79 selected tests/subtests across five affected packages. Full pkg/container/bytejson, pkg/pb/plan, pkg/sql/plan/function, pkg/sql/plan and pkg/sql/compile package tests passed.
  • The exact candidate service at 5a94a5b812358487e7768ed2932a582f3ca84650 passed the canonical func_json_search.sql mo-tester BVT twice, 60/60 each time, with catalog cleanup checked between runs. The tester ignored JDBC metadata as in the existing harness. go vet, incremental golangci-lint, gofmt and diff check passed.
  • Integrated main 35202093259793e48dcd7abc8ff418f07190f746; later main d24f446e1e94a58c329d422519f7aad621cdcd05 contains LIKE-prefix statistics work and merges cleanly without changes to the JSON_SEARCH identity or implementation. This local evidence does not claim exact-head CI, mixed-binary validation, deployment or QA.

Remote-protocol repair at 27829c6

  • The JSON_SEARCH feature now raises the existing local/cached-plan, remote placement, destination, bound-stream and receiver fences to the same provisional v136 floor. The highest required floor is retained when expression contracts combine.
  • Focused tests using a bound expression and simulated protocol peers failed on the previous head and pass after repair. They cover unknown/predecessor/current peer versions, fallback, changed/unknown destination, the stream handshake, wire decoding and local cached-plan validation. Adjacent JSON, ODKU and protocol tests, the full pkg/sql/compile package, go vet, incremental lint and git diff --check passed.
  • The first service build failed because the local disk ran out of space. After space recovered, an exact-head build succeeded and its version output identified 27829c66f9. The canonical func_json_search.sql BVT passed 56/56 twice on one owned service, with the table/view cleanup checked between runs. The tester could not parse a result path inside a hidden-directory checkout on its first attempt; the successful runs used byte-identical case/result copies in an isolated non-hidden path. The prior BVT evidence below remains historical. Separately built old/new processes and a mixed-version cluster are NOT_RUN.
  • This is an incremental Draft repair, not final protocol allocation or release qualification. Independent semantic review, final merge-order reconciliation and exact-head CI remain pending.

Main integration and protocol admission at 7804185

  • Merged main d2e71035dbae7471052ca5c0034d05827b926249. Adopted the current LIKE matcher API with exact case-sensitive matching. Kept JSON_SEARCH identifiable through binder and optimizer folding, and gated executor entry before planner metadata inference can evaluate it.
  • The new SQL planning regression reproduced loss of the protocol marker in ordinary, nested, and prepared projections before the fold guards. The executor regression reproduced successful execution on v134 before the entry-point guard. The final candidate retains the marker, rejects execution on v134, and returns the expected path on v135.
  • mo-cgo-test -race -count=1 -timeout=240s -vet=all passed 295 selected tests and subtests in pkg/container/bytejson, pkg/pb/plan, pkg/sql/plan/function, pkg/sql/plan, pkg/sql/plan/rule, and pkg/sql/compile. Incremental golangci-lint, gofmt and diff checks passed. Independent read-only review verified the local, destination, receiver and VIEW protocol paths.
  • make build using Go 1.27.1 produced a service that reported commit 7804185038eb. mo-tester executed the canonical func_json_search.sql twice against that service, 60/60 each time with zero failed, ignored or abnormal cases. JDBC metadata comparison followed the historical harness setting. The test tables and view were absent after each run, and the isolated service stopped.
  • Required GitHub checks, a live mixed-binary deployment, and QA are pending.

@mergify mergify Bot added the kind/bug Something isn't working label Oct 22, 2026
@matrix-meow matrix-meow added the size/XL Denotes a PR that changes [1000, 1999] lines label Oct 22, 2026
VioletQwQ-0 and others added 25 commits December 3, 2026 13:53
@XuPeng-SH

XuPeng-SH commented Dec 3, 2026 •

Copy link
Copy Markdown
Contributor

mo-bot review · mo-bot-local · done

Commit: 038c2c4db43df000afd1c4babbebd8fceeb23506

Review completed. Read the assessment.

@XuPeng-SH XuPeng-SH left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mo-bot review · mo-bot-local · review

Commit: 038c2c4db43df000afd1c4babbebd8fceeb23506

Assessment: request_changes

JSON_SEARCH has a substantial matcher-memory amplification, and its shared parser change can alter the meaning of existing JSON paths. The location-aware traversal and reuse of LIKE semantics are otherwise justified; the specific issues raised in the prior reviews are addressed.

Model: gpt-6.1-terra / max

Session: 01a237df-a073-7910-ac2c-836d2d273b8a · slot 1 · generation 43

  • P1 pkg/sql/plan/function/func_builtin_json_search.go:465: A search uses a large non-binary literal pattern, for example JSON_SEARCH('{}', 'one', REPEAT(_utf8mb4'a', 3400000) COLLATE utf8mb4_bin).
    Impact: The function compiles a regexp before discovering that the document has no string leaves. Its Go-heap allocations bypass the result account’s path reservations, so a few valid searches can exhaust CN memory.
    Evidence: The row loop calls prepareMatcher before traversal, and the default matcher always calls prepareLikeRegexp. An isolated probe of the checkout’s regexp engine increased peak RSS from about 16 MiB after an equality control to about 724 MiB while compiling the 3.4 MB literal; it used Go 1.26.6 rather than the required Go 1.27.1 and did not run a SQL service. Ordinary LIKE already has a no-wildcard comparison fast path. Reuse an appropriate LIKE fast path or otherwise bound and account matcher memory while preserving wildcard behavior.

  • P2 pkg/container/bytejson/path.go:350: An existing JSON_EXTRACT or JSON_SET path consists of $.a followed by U+00A0, and the document contains keys a followed by U+FFFD and a followed by U+00A0.
    Impact: The merge-base parser selects the U+FFFD key, while this change selects the U+00A0 key. Existing generated expressions can consequently produce different values on later writes from values or indexes created before an upgrade.
    Evidence: The old parser treats byte 0xA0 as whitespace and strconv.Unquote replaces the truncated UTF-8 sequence; the new scanner consumes the complete UTF-8 key. A retained parser model demonstrates both results with an unchanged ASCII control. The published v4.2.8 release and its 20261114 hotfix use the old parser, and the stopped-upgrade contract keeps older 4.2 data in scope. Preserve existing ParseJsonPath semantics or provide a compatibility-preserving migration, while retaining the new search grammar and usable returned locations.

Validation:

  • Isolation preflight and merge-base-to-head git diff --check passed; receipts are checks/1796282173973177288-3.json and checks/1796282885118972967-5.json.

  • The parser model and regexp component probe are retained with their outputs and receipts: checks/1796282737237202539-4.json and checks/1796283262084832324-4.json.

  • The frozen head’s CI snapshot reports successful x86 unit, shared-build, coverage, and two multi-CN BVT jobs. Earlier focused review tests remain relevant to unchanged traversal and executor patch sections.

  • The review plan, validation record, and assessment of all 23 discussion keys are saved in the assigned diagnostic directory.

Limitations:

  • The Go 1.27.1 toolchain download timed out on both attempted proxies, so no fresh full-package or public SQL-service test ran locally. The regexp measurement used the checkout’s engine with Go 1.26.6.

  • The supplied snapshot does not include the umbrella issue body or an independently identifiable v4.2.9 release artifact.

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/XXL Denotes a PR that changes 2000+ lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants