Skip to content

Share JSON parsing in projections and preserve statistics on cancellation - #32980

Merged
XuPeng-SH merged 19 commits into
matrixorigin:mainfrom
iamlinjunhong:codex/loom/develop/6a8ad50c99031262f622b1d495fb9c5a68d8befb89bed8a2ee20d811b23c17ef
Nov 23, 2026
Merged

XuPeng-SH merged 19 commits into
matrixorigin:mainfrom
iamlinjunhong:codex/loom/develop/6a8ad50c99031262f622b1d495fb9c5a68d8befb89bed8a2ee20d811b23c17ef

Conversation

@iamlinjunhong

@iamlinjunhong iamlinjunhong commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

What type of PR is this?

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

Which issue(s) this PR fixes:

The reporter will verify the workload after merge.

What this PR does / why we need it:

A joined UPDATE that extracts several fields from the same LONGTEXT manifest could parse each document once per field. Processing a large document could also delay cancellation, and failed statements could lose statistics for work that had already run.

  • Share text JSON parsing across eligible constant-path expressions in the same physical projection, including guarded assignments that select the same rows. Keep other branches demand-driven and bound metadata and extracted values together at 4 MiB per batch in MPool-tracked Go heap scratch on base pools. Projections with execution allocation or physical admission use ordinary evaluation under their existing budgets. Preserve SQL NULL, JSON null, missing paths and invalid JSON behavior.
  • Check for cancellation while traversing vectors and JSON paths, parsing large documents and assembling query results. Use the current request context for binder folds that contain JSON extraction, including CLONE timestamp hints. Evaluate those folds on a child process so prepared scans and metadata binding retain their existing process context.
  • Capture observed operator and scan statistics from the terminal execution attempt after execution has stopped. Mark these statistics as partial and include coverage information for remote operator reports.
  • Add a joined UPDATE regression case covering selection masks, null and missing values, and atomicity when an active row contains invalid JSON.

Performance and cancellation

On a local single-CN setup with 5,000 synthetic documents totaling about 897 MB, wall time for the seven-field UPDATE fell from 6.332–6.369 s to 1.097–3.438 s with an upper bound and from 6.757–6.797 s to 1.160–1.569 s without one. All 32 timed SQL runs matched the expected results row by row. In the 100-row window, the wide manifest scan remained at 100 rows and 17.11 MiB on both revisions. Peak query-domain memory for the seven-field case fell from 786.21 to 773.33 MiB, while peak sampled process RSS across the timed sequence rose 8.3%.

On the same synthetic workload, each cancellation action was measured once per revision. Time from action to server-side statement completion fell from 543.78 to 29.86 ms for KILL QUERY and from 766.96 to 372.35 ms for TCP disconnect. Both statements rolled back with zero writes, subsequent queries succeeded, and their failed statement records retained partial scan counts and observed operators. These measurements came from a local single-CN setup with direct TCP connections.

Validation

  • Targeted Go tests for parsing, projection, cancellation, and partial diagnostics passed. Full frontend and planner package tests, go vet, and fast lint also passed.
  • The existing JSON_EXTRACT BVT passed 364/364 cases. The new JOIN UPDATE BVT passed 14/14 cases on each of two runs. Same-connection CASE/BETWEEN and CLONE timestamp expressions matched the baseline.
  • The full function BVT reported six time-zone differences that reproduced byte-for-byte on the ordered baseline. The targeted race run did not reach execution, and full incremental lint did not complete.

CI repair validation

  • In c2060e760afa, the JSON key sort returns cancellation directly and keeps keys paired with their values. A duplicate-key execution failure now asserts partial statistics and leaves the original row intact. The compile-failure control asserts that no execution evidence was published.
  • Local Darwin/arm64 CGo checks passed for the bytejson package and its two focused race tests, and request context during JSON binding and CLONE. Reused the preceding repair revision's passing projection reuse and compile diagnostics generation tests because the final binder change does not enter those test paths. Targeted molint, golangci-lint and go vet passed.
  • Coverage-mode SQL tests passed for prepared external scan results, view DDL and terminal statement diagnostics. A two-CN wire probe on the preceding repair revision passed the publication success and rejection cases with fault injection disabled throughout. Those SQL assertions contain no JSON extraction, so they cover the same binding path after the final change. The full Linux compose and coverage suites passed on c2060e760afa. Passing CI Prior CI failures
  • The LOCAL upload cancellation case passed three focused repetitions on the original PR head and on official main. The Linux coverage occurrence is tracked separately. MatrixOne #31475

Review fix validation

  • On 39f21601217b, the full ByteJSON, colexec, projection and SQL function Go packages passed on Darwin/arm64. Focused race tests, go vet, molint and incremental golangci-lint passed.
  • Two separate wire SQL runs of the existing func_json_extract_join_update.sql statements on the same fresh single-CN fixture matched the expected results, rollback and teardown.
  • BenchmarkProjectionJSON, 1,024 rows and three local repetitions per mode. At the median, dense seven-field extraction took 4.3 ms with sharing and 25.6 ms with the ordinary evaluator. Sparse CASE took 13.7 ms and 13.6 ms respectively, with about 4.85 MB of Go heap allocation per batch in both modes.

Rebase validation

  • Rebased onto official main f1ffbaaff35d. The projection executor keeps the JSON binding alongside the current Vector API. The previous three review fixes remain in ce5aba01e490.
  • On Darwin/arm64, ByteJSON, colexec, projection, and SQL function checks and targeted go vet passed. The existing JOIN UPDATE SQL matched expected results, rollback, and teardown twice over MySQL on one single-CN fixture. The statement diagnostics integration test passed.
  • The previous Linux/x86 coverage producer reported 0 affected rows where TestSQLTaskAlterAfterTriggerOnRealStorage/overlap_cancel expected 1 during the setup UPDATE. Coverage aggregation and CI Required then failed. On the rebased head, the parent test and all subtests passed three Darwin/arm64 runs with -short -tags matrixone_test -covermode=set and coverage scoped to four packages. The new Linux run will verify the rebased head. Previous coverage failure

CI refresh validation

  • Rebased onto official main e218f94ba2. All ten patches are unchanged according to git range-diff.
  • On bdcb2e74cc, focused ByteJSON, colexec, projection, and SQL function tests and go vet passed. TestIssue29572LogicalViewAuthorization passed three times on Darwin/arm64 with -short -race -tags matrixone_test.
  • The previous Linux/x86 UT hit the 120-minute outer deadline while SQL integration tests were still running. The same head passed coverage and both BVT jobs. The diagnostic upload omitted the details of earlier failures, including the named authorization test and an embed batch. The local checks cover the named test. The new Linux CI run covers the full suite. Previous Linux/x86 UT

Guarded JOIN UPDATE and deep-path validation

  • On eec32c74d73b, TestProjectionJSONPlannedJoinedUpdate verified one parse per selected LONGTEXT document for two guarded assignments. Focused ByteJSON, colexec, projection and SQL function tests passed on Darwin/arm64, along with go vet, molint and fast golangci-lint for those packages.
  • A local single-CN MySQL run verified both assignments, skipped malformed JSON outside the target rows and rolled back on malformed JSON in a target row. TestStatementDiagnosticsSQL also passed, including the compile- and execution-failure cases.
  • BenchmarkJSONQueryDeepSimplePaths used two simple paths at depth 512. Median local runtime with cancellation checks fell from 388 to 12 µs/op over three repetitions per revision. This measures path traversal on Darwin/arm64. The full Linux suite passed on the preceding head. Previous CI
  • Rebased onto dea4f40b17d0 and kept main’s physical row selection and MPool accounting.

Projection rebase validation

  • c180b993e6b9 rebases onto d9a43b3156dd. The projection keeps main’s VALUES warning-row offset and the PR’s JSON frame. The planned JOIN UPDATE parse-count test, physical selection, cache admission, deep-path cancellation, and partial diagnostics checks passed on Darwin/arm64. The MySQL ENUM/SET assignment regression, focused go vet, fast golangci-lint, and the Loom artifact check also passed.
  • Linux coverage run 45047452385 attempt 1 failed in TestSnapshotPublicationSkipsExternalTables/no_publication. The runner’s memory admission guard confirmed 1,053,282,304 available bytes against a 1,073,741,824-byte reserve and rejected a 24-byte scan-selection request after restore. The focused case passed three times on eec32c74d73b and once on c180b993e6b9 with -short -tags matrixone_test -covermode=set and four instrumented packages on Darwin/arm64. The rebase starts a new full Linux run. Failed coverage job

Static analysis follow-up

  • On c180b993e6b9, Linux SCA reported SA1012 for a nil context in simple JSON traversal and prealloc for the planned JOIN UPDATE test. The fix passes the cancellation check explicitly and preallocates the test results. The traversal order, cancellation interval and test assertions are preserved. Failed SCA job
  • golangci-lint 2.14.0 reproduced both findings and reported zero afterward when run with prealloc,staticcheck on ByteJSON and colexec. Local go vet, ByteJSON, JOIN UPDATE plan, selection mask, and final-row cancellation tests passed before rebase. The wider local lint run timed out while loading packages.
  • 9fbdc258611b rebases the twelve equivalent patches onto febc2b472e15, which adds lock-read diagnostics. The rebased frontend, compile and MySQL statement-diagnostics regressions passed. Local depth-512 traversal medians from three interleaved samples were 9.11 to 9.28 µs/op for ordinary traversal and 9.15 to 9.16 µs/op with cancellation polling.

Projection memory budget

  • The allocation finding reproduced at a 33,536-byte limit on the previous head. On 081a75adfdd2, both results fit with an execution account, inherited physical admission, and a tightly capped base pool. Base-pool scratch retains parse sharing and leaves the off-heap cap available for required results.
  • Focused Go projection and cancellation tests, 100 race-enabled capacity regression repetitions, local MySQL guarded JOIN UPDATE and rollback, and configured colexec lint passed on Darwin/arm64. The capacity limit was exercised at the Go projection entry point. Previous head Linux CI
  • In three single-CPU BenchmarkProjectionJSON samples at 1,024 rows, median dense seven-field times were 5.14 ms with sharing and 31.39 ms with ordinary evaluation. Sparse CASE allocation stayed around 4.84 MB per batch in both modes.

Vector ownership rebase

  • Rebased onto official main 4cadd4f2f6ed, where each Vector has a single MPool owner. On e7802609de59, the selected projection opens and releases the JSON frame around evaluation of the physical rows. The regression checks one parse per selected row across both fields, skips malformed masked rows, and verifies cleanup when a selected row fails.
  • On Darwin/arm64, the colexec, projection and table scan packages passed in short mode. Focused JSON extraction and diagnostics tests, 20 race repetitions of the selected-row and output-budget regressions, local MySQL guarded JOIN UPDATE and rollback, and scoped golangci-lint passed.
  • The previous Linux workflow ended while UT, SCA, coverage and both active BVT jobs were running. The rebased head starts a new Linux run. Previous workflow

Cancellation cleanup

  • On 3615089d4508, long cancellable JSON parses leave their temporary tree to Go GC. Cancellation during parsing or encoding and replacement of duplicate keys no longer walk a discarded subtree to recycle groups. The frontend binding test retains its live-request, canceled-request and context-restoration checks after removal of its test-only SET helper. Review findings
  • ByteJSON package tests and the package race run passed on Darwin/arm64. The wide-tree cancellation regression passed 100 race repetitions. Focused projection, SQL JSON extraction and frontend request-binding tests and scoped lint passed. Previous Linux CI
  • For a synthetic 12 MiB nested input, after a warm-up plus three measured rounds, median time from cancellation to parser return fell from 54–93 ms to 5–9 µs across late parsing, pre-encoding and encoding. Successful parsing of the 180 KiB text-heavy fixture used about 467–468 kB of Go heap allocation per operation. The 20 KiB group-heavy fixture rose from 432 to 794 kB per operation. These are parser measurements on Darwin/arm64.

JSON window constant binding

  • The LIMIT example in the review fails during argument binding with an invalid cast to uint64. The dispatched base 4cadd4f2f6ed9 and reviewed head 3615089d4508 use the same LIMIT binder, which applies pagination's numeric coercion to the JSON function's arguments before JSON extraction can execute. Review
  • On a reused MySQL connection, the same stale-context mechanism was reachable in the constant offset for NTH_VALUE, the EMA period check, and RANGE INTERVAL normalization. Commit a762397b4714 evaluates those JSON expressions in a child process with the current request context. Each query now returns its expected rows on the same connection.
  • Fresh Darwin/arm64 CGo validation passed for TestWindowJSONConstantFoldUsesRequestContext, TestFrontendExpressionContextAcrossRequests, and targeted pagination, window and publication binding controls. The planner test also checks current-request cancellation and that the original session process context is preserved. Reused successful Linux unit, coverage, static analysis and BVT results from 3615089d4508 for the earlier changes. Previous CI
  • Scoped go vet and repository-pinned molint check passed for the planner and embedded test packages. The separate golangci-lint and race runs stopped during local build.

JSON defaults and cancellation during binding

  • Commit fd94c404bd89 uses the current statement context when folding JSON defaults in DDL. It preserves cancellation and deadline errors while evaluating window indicator periods. Invalid periods retain the existing diagnostic. Review
  • Before the fix, a canceled previous request caused planner failures for INT, MEDIUMINT and unsigned DECIMAL defaults. EMA reported an invalid period for a canceled current request. On Darwin/arm64 the new planner regressions pass, and CREATE TABLE, ALTER ADD and ALTER MODIFY succeed on one reused MySQL connection. An insert without explicit values reads back both defaults. The frontend protocol test confirms the existing error 1317 mapping for cancellation.
  • Targeted tests passed for DDL defaults, CTAS, ALTER and window binding, along with go vet and pinned molint check and incremental golangci-lint. Reused the Linux unit, coverage, static analysis and multi-CN BVT results for the preceding head a762397b4714. This run used deterministic context injection to test planning cancellation. Previous CI

JSON bounds in partition DDL

  • Commit 2afc6b1fae7f evaluates JSON expressions in RANGE ordering and LIST uniqueness checks under the current request context. The planner regression reproduces both failures on fd94c404bd89 and verifies on the new commit that valid bounds succeed, invalid bounds retain their diagnostics, and cancellation of the current request propagates. Review
  • Targeted planner tests passed on Darwin/arm64, along with RANGE and LIST CREATE TABLE and ALTER ADD PARTITION through one reused MySQL connection. Reused the preceding head's passing Linux unit, coverage, static analysis and multi-CN BVT results for the earlier changes. Previous CI
  • Scoped go vet, pinned molint check, and incremental golangci-lint passed. The planner tests exercise cancellation through deterministic context injection.

@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 Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Queue requested — the merge queue status continues in this comment ↓.

@XuPeng-SH

XuPeng-SH commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

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

Commit: e7802609de59841514f1daa34cfa669865c02037

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: e7802609de59841514f1daa34cfa669865c02037

Assessment: request_changes

The selected-row projection preserves row masks and leaves required output capacity available. The remaining cancellation gap is synchronous cleanup of large parse trees after cancellation has already been detected.

Model: gpt-6.2-sol / xhigh

Session: 01a1ee80-0d82-7030-a965-b51f496c3054 · slot 2 · generation 1

  • P2 pkg/container/bytejson/cancel_parse.go:64: Cancel JSON_EXTRACT after it has parsed a large LONGTEXT document containing many nested containers.
    Impact: The parser delays returning the cancellation error while it recursively recycles every parsed group. The delay grows with the amount of JSON already parsed.
    Evidence: The cancellation return at line 71 still runs n.Free(), which walks the entire tree in pkg/container/bytejson/bytejson.go:2081. The parser probe measured 104–145 ms from cancellation to return for a valid 12 MiB document. Bound synchronous cleanup on cancellation and cover the case where a large tree has already been built. See cancel-cleanup-wide.stdout and checks/1795409566510030809-2.json.

  • P3 pkg/frontend/util.go:462: The request-context regression invokes bindSetVariableResultExpr to check SET rebinding.
    Impact: The assertion can pass while the actual SET execution path regresses, and the helper duplicates a projection bind already exercised by the same test.
    Evidence: The helper's only caller is pkg/frontend/frontend_context_test.go:224. Production SET calls getExprValueWithPrepareMeta and executes a synthetic SELECT through executeStmtInSameSession. Remove the redundant helper and assertion, or exercise the real SET path.

Validation:

  • 28 focused Linux race tests passed across ByteJSON, projection, compile, frontend, and SQL functions. See focused-race-native.jsonl and checks/1795409781556583887-2.json.

  • The Go 1.27.1 long-number differential probe passed. See number-compare.stdout and checks/1795409174409332398-2.json.

  • Isolation preflight and git diff --check passed. Frozen CI records show successful Linux unit, coverage, static analysis, proxy BVT, and pessimistic multi-CN BVT jobs.

Limitations:

  • The cleanup probe measures parser return latency on synthetic input. Statement-level KILL QUERY and disconnect timings come from the author's single-CN runs.

@XuPeng-SH

XuPeng-SH commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

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

Commit: 3615089d4508d5944a8d320e086fcab2633bbbd0

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: 3615089d4508d5944a8d320e086fcab2633bbbd0

Assessment: request_changes

The revision removes synchronous parse-tree cleanup on cancellation and preserves the projection memory budget. LIMIT binding still evaluates constant JSON expressions using the previous request’s context.

Model: gpt-6.2-sol / xhigh

Session: 01a1ee80-0d82-7030-a965-b51f496c3054 · slot 2 · generation 1

  • P2 pkg/sql/plan/function/func_builtin_json.go:1114: On a reused MySQL connection, submit a valid query such as SELECT 7 LIMIT JSON_LENGTH(JSON_EXTRACT('{"n":[1]}', '$.n')) after the previous request has completed and its context has been canceled.
    Impact: The live request can fail during planning with context canceled before it returns any rows.
    Evidence: LimitBinder.foldConstant at pkg/sql/plan/limit_binder.go:174 passes the session process directly to ConstantFold. The evaluator copies proc.Ctx into its child, and the new JSON cancellation check reads that context. Starting the next request updates the top context, while the completed request’s context has been canceled. Route LIMIT folding through the existing request-context helper and cover the case on a reused connection.

Validation:

  • Verified the frozen checkout, patch, pinned policy, native inputs, and isolation preflight. Accounted for all 19 discussion entries.

  • Eleven focused ByteJSON race tests passed, and the wide-tree cancellation regression passed 100 race repetitions. The parser probe measured 2.4–3.3 µs from cancellation to return on the synthetic documents. Successful group-heavy parsing allocated about 794 kB/op versus 431 kB/op for the legacy parser.

  • Frozen CI recorded successful Linux unit, coverage, static analysis, proxy BVT, and pessimistic multi-CN BVT jobs for this head.

Limitations:

  • The LIMIT finding is based on the source trace. Local planner, frontend, and MySQL probes timed out during build before executing. Commands, receipts, and logs are indexed in review-validation.md.

  • The parser probe measured component behavior. Production UPDATE latency, process RSS, and client-disconnect timing were not independently remeasured.

@XuPeng-SH

XuPeng-SH commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

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

Commit: a762397b47142a7be7bdfcb19374f22149ae703d

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: a762397b47142a7be7bdfcb19374f22149ae703d

Assessment: request_changes

The guarded JOIN UPDATE reuses parsing within a bounded projection cache, and failed executions retain partial diagnostics from the terminal attempt. Two request-context defects remain. A live CREATE TABLE can inherit cancellation from a previous request, and EMA binding can report a canceled request as an invalid period. The earlier LIMIT example fails numeric coercion before JSON extraction.

Model: gpt-6.2-sol / xhigh

Session: 01a20682-9189-75a0-839a-f36d8b2372a5 · slot 1 · generation 3

  • P2 pkg/sql/plan/function/func_builtin_json.go:1114: On a reused MySQL connection, run SELECT 1 and then create a table with an integer column whose default is JSON_LENGTH(JSON_EXTRACT('{"n":[1]}', '$.n')).
    Impact: The valid CREATE TABLE fails with MySQL error 1317 even though the current request is live.
    Evidence: The MySQL probe reproduced error 1317. The same DDL planned successfully with a live process context and failed with a canceled previous process context. The CREATE TABLE binder takes that previous context at pkg/sql/plan/build_ddl.go:4068 and passes the session process directly to ConstantFold at pkg/sql/plan/build_util.go:1241. Use the current compiler context and the request-aware fold helper for the default expression. See binder-probes.jsonl and checks/1795428171088501629-2.json.

  • P3 pkg/sql/plan/window_binder.go:1420: The current request is canceled while the planner folds a valid EMA period containing JSON_EXTRACT.
    Impact: The binder replaces the interruption with an invalid-period error. MySQL clients lose the cancellation identity that maps to error 1317.
    Evidence: TestWindowJSONConstantFoldUsesRequestContext accepts the expression with a live context and explicitly expects the invalid-period error after cancellation. The fold discards the context error, and pkg/frontend/protocol.go:284 classifies interruption from error identity. Propagate cancellation and deadline errors while preserving the existing diagnostic for invalid periods. See focused.jsonl and checks/1795428016213967619-2.json.

Validation:

  • Verified the frozen checkout, patch, whitespace and retained native inputs. Private /tmp and loopback preflight passed. See scope.log and preflight.log with receipts 1795427726033315374-2 and 1795427725148716299-2.

  • The full ByteJSON package passed under race. Focused tests passed for joined UPDATE sharing, row masks, memory budgets, retry and remote diagnostics, and all three repeated-connection window cases. See bytejson-race.jsonl and focused.jsonl with receipts 1795427789486228669-2 and 1795428016213967619-2.

  • Planner and MySQL probes reproduced the DDL regression and verified the LIMIT cast error. Focused JSON extraction cancellation, frontend planning and CLONE tests also passed. See binder-probes.jsonl and receipt 1795428171088501629-2.

  • Frozen CI recorded success for Linux unit tests, coverage, arm64 static analysis and pessimistic multi-CN BVT. All 21 discussion entries are accounted for in discussion-assessment.json.

Limitations:

  • EMA cancellation was exercised in the planner and traced through frontend error handling. No in-flight MySQL KILL QUERY was issued for that case.

  • Performance and disconnect timings come from the author's synthetic single-CN workload. Production behavior was not remeasured.

@XuPeng-SH

XuPeng-SH commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

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

Commit: fd94c404bd89efe9e0349ee3430efeb798da36da

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: fd94c404bd89efe9e0349ee3430efeb798da36da

Assessment: request_changes

The revision resolves the prior JSON default and EMA cancellation findings. The bounded projection cache and terminal-attempt diagnostics retain their validated behavior. RANGE partition validation still reads the previous request’s canceled context and rejects valid DDL.

Model: gpt-6.2-sol / xhigh

Session: 01a20682-9189-75a0-839a-f36d8b2372a5 · slot 1 · generation 3

  • P2 pkg/sql/plan/function/func_builtin_json.go:1114: On a reused MySQL connection, run SELECT 1, then create a RANGE-partitioned table with successive bounds of 1 and JSON_LENGTH(JSON_EXTRACT('{"n":[1,2]}', '$.n')).
    Impact: The live CREATE TABLE fails during planning with MySQL error 1317 (SQLSTATE 70100). The valid partition definition is rejected.
    Evidence: The exact-head planner probe accepted the same DDL with a live process context and returned context canceled when only the previous process context was canceled. The MySQL probe reproduced error 1317. CREATE supplies the current context at pkg/sql/plan/build_ddl.go:3458, but the ordering check at pkg/sql/plan/partition_binder.go:186 evaluates with the session process. LIST uniqueness uses the same raw process at line 251. Use processForBoundExpr with the current context for both checks. See context-review.jsonl and receipt 1795433644967666450-2.

Validation:

  • Verified the frozen checkout, patch, native inputs and isolation preflight. See scope.log, preflight.log and receipts 1795433411635523083-2 and 1795433410851393997-2.

  • Exact-head planner and embedded MySQL tests passed for JSON defaults, CTAS and window binding. The EMA test verified cancellation and deadline error identity. See binding.jsonl and receipt 1795433626582377465-2.

  • Reused passing ByteJSON race, projection and diagnostic tests from the preceding head for unchanged paths. Frozen CI recorded success for Linux unit tests, coverage, arm64 static analysis, proxy BVT and pessimistic multi-CN BVT. See review-validation.md.

  • Accounted for all 23 discussion entries in discussion-assessment.json. The earlier LIMIT example fails numeric coercion before JSON extraction.

Limitations:

  • RANGE CREATE was reproduced through MySQL. LIST and ALTER ADD PARTITION were traced in source.

  • EMA cancellation was exercised in the planner. Production UPDATE performance and disconnect timings were not independently remeasured.

@XuPeng-SH

XuPeng-SH commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

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

Commit: 2afc6b1fae7f232ba56a4397abf05b4b96ee2702

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: 2afc6b1fae7f232ba56a4397abf05b4b96ee2702

Assessment: approve

The revision fixes the stale request context in RANGE and LIST partition validation. The existing evaluator preserves row masks and output memory budgets while sharing JSON parsing across eligible joined UPDATE assignments. Failed statements retain partial diagnostics from the terminal execution attempt. The earlier LIMIT example fails numeric coercion before JSON extraction and does not demonstrate a cancellation regression.

Model: gpt-6.2-sol / xhigh

Session: 01a1f0a0-5126-78f3-9ab8-ef4e87f2f119 · slot 0 · generation 3

Validation:

  • Verified the frozen checkout, patch, pinned policy, native inputs, and isolation preflight. Accounted for all 25 discussion entries in discussion-assessment.json. Receipts and logs are indexed in review-validation.md.

  • Exact-head planner and MySQL tests passed for RANGE and LIST CREATE, ALTER ADD RANGE, JSON defaults, and window expressions. The planner also verified invalid bounds and current-request cancellation. See partition-and-binding.jsonl and receipt 1795445203637477247-2.json.

  • Exact-head planner and MySQL pagination probes confirmed matching coercion or syntax errors for the JSON LIMIT variants. Literal LIMIT and connection controls returned the expected result. See pagination-probe.jsonl and receipt 1795445327098007745-2.json.

  • Reused passing ByteJSON race and focused projection and diagnostics results for unchanged paths. Frozen exact-head CI passed Linux unit tests, coverage, arm64 static analysis, proxy BVT, and pessimistic multi-CN BVT.

Limitations:

  • UPDATE timing, RSS, and disconnect measurements came from the author's synthetic single-CN workload. Production performance and disconnect latency were not independently measured.

@mergify

mergify Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

🚫 Left the queue · pull request dequeued

27 min in the queue, with no time running CI.

So far

  • ✅ Entered the queue Mon 23 Nov, 15:11 · rule main · triggered by rule Automatic queue on approval for main
  • ⏹️ Testing stopped · in place
  • 🚫 Left the queue 15:38 · 593e832

Reason

Pull request #32980 has been dequeued

Pull request from fork cannot be queued. This pull request comes from a fork, and Mergify needs the author's permission to update its branch.

The author needs to enable "Allow edits from maintainers" on this pull request.

To get back in the queue

  • Push a change if one is needed: the pull request is queued again once its queue conditions match.
  • If no change is needed, tick the box below to queue it again as it is.

Merge conditions not met when it left the queue

  • any of · required by GitHub branch protection:
    • check-neutral = CI Required
    • check-skipped = CI Required
    • check-success = CI Required

Tick the box to put this pull request back in the merge queue (same as @mergifyio queue).

  • Requeue this pull request
2 merge conditions met
  • #review-threads-unresolved = 0 · required by GitHub branch protection
  • github-review-approved · required by GitHub branch protection

Times in UTC · dashboard · how the merge queue works

This branch was successfully deployed

No deployments
ci — 593e832c Deployed Nov 23, 2026 by mergify[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dequeued kind/bug Something isn't working kind/enhancement size/XXL Denotes a PR that changes 2000+ lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants