Repository navigation
fix(sql): align approximate numeric text notation with MySQL - #30316
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? |
|
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: 5c251b03282789dd04563ff57b25f9de229a37ee
Assessment: request_changes
Reviewed all 28 changed files and affected callers. Centralizing display formatting while preserving fulltext token spelling is reasonable, but the planner’s unchanged string-width bound causes reproducible numeric truncation.
Model: gpt-6-astra / xhigh
Session: 01a13dcf-1586-7a01-9000-d45e20995cf8 · slot 1 · generation 1
- P2
pkg/sql/plan/function/func_cast.go:10738: SELECT CONCAT(CAST('-1.2345678901234567e-15' AS DOUBLE));
Impact: The new formatter emits 34 bytes, but formattedStringByteBound still assigns DOUBLE a 32-byte bound in string_result_domain.go:123. CONCAT consequently inserts a VARCHAR(32) cast that silently removes significant digits. Update the shared planner bound to accommodate the new maximum and add SQL regression coverage for long fractional representations.
Evidence: The SQL planner/executor probe returns '-0.00000000000000123456789012345'; an explicit CHAR(64) cast returns '-0.0000000000000012345678901234568'. Three boundary cases fail and two nearby controls pass. All five pass when func_cast.go is restored from the base through an overlay. Retained evidence: consumer-tests.jsonl with receipt 1792092789851193424-2.json; width-base-control.jsonl with receipt 1792092815190166890-2.json.
Validation:
-
Reconciled commands, source fingerprints, exit receipts and retained logs in /home/xupeng/.local/state/mo-bot/jobs/82496bc199f00a56cac3859b/attempt-1/validation-audit.json. Source remains unchanged.
-
Isolation preflight passed. Recovered native prerequisites through Makefile cgo after verifying 192 inputs and 62 artifacts; the initial missing-header failure occurred before bytejson tests executed.
-
Utility, bytejson, aggexec and function package suites passed. Focused Parquet and remote-expression tests passed. Additional probes verified 21,896 finite DOUBLE values, FLOAT precision, binary JSON round-trips, unchanged fulltext tokens and nonfinite rejection.
-
Three-sample microbenchmarks measured five-value JSON serialization increasing from 165 to 247 ns/op for ordinary numbers and 189 to 253 ns/op for exponent cases, with unchanged allocations. Scalar exponent formatting reduced allocations from two to one.
-
The frozen evidence reports successful exact-head Ubuntu UT, Linux/arm64 SCA and both BVT groups; individual CI case logs were unavailable.
Limitations:
-
The reproduction exercises SQL parsing, planning and expression execution, not a live frontend connection.
-
No live MySQL comparison or local full-service BVT rerun. Author execution artifacts and the full linked-issue body were not supplied.
-
Base comparisons use exact base formatting-source overlays on current dependencies. Microbenchmarks do not establish end-to-end SQL performance.
Reconstruct only affected subtrees so unrelated persisted FORMAT and internal SET FIND_IN_SET bindings remain intact. Rebuild affected FORMAT arguments with the catalog VARCHAR(max) declaration and scope internal binding to SQL-origin verified trees. Charge affected scans and FORMAT normalization to the existing candidate budget. Preserve official main's DUMP binding eras and session witnesses after rebase, with an orthogonal historical float mode and owned default-session scratch. Pin the historical CHECK name in its independent compatibility fixture test. Add seven independent predecessor-source fixtures plus insert/update BVT compositions. Validation: full plan package, focused formatter/JSON consumers, real seven-table catalog upgrade, and two 37/37 BVT rounds with teardown checks. Addresses review 5566548101 for matrixorigin#30227.
Reconstruct legacy IN/NOT IN coercions through their binding owner, including nullable comparisons expanded from membership expressions. Keep historical equality, overload identity, whole-tree equivalence, explicit cast limits, copy-on-write ownership and resource guards. Traverse persisted expression owners lazily so unaffected tables avoid allocating a candidate slice during resolution. Add nine independent historical fixtures, execution and allocation regressions, and public SQL coverage for IN/NOT IN/NULL/explicit casts. Validation: full planner package, vet and lint pass; nine historical catalog tables pass INSERT/UPDATE after same-disk restart using exact predecessor CAST/width overlays on current dependencies. BVT passes 42/42 twice with teardown verified. One warm-up plus three measured rounds reduces clone+migration from 22,976 B/10 allocations to 1,600 B/2 allocations, matching clone-only allocations. Addresses review 5598679079 on PR matrixorigin#30316. Related to matrixorigin#30227.
Reconstruct predecessor scalar and recursive JSON constant formatting only inside isolated catalog proof evaluators. Keep typed folded constants intact while widening live conversions, and independently verify the complete current SQL tree with authenticated frozen-constant boundaries. DUMP now considers historical folding even without surviving casts, and admits repaired mixed trees without relaxing ordinary payload equality. Select the extra eras from resolved formatting dependencies to preserve unrelated temporal budgets. Retain explicit/assignment casts, overloads, source ownership, cancellation, warning isolation and resource limits. Add 22 independent historical definitions and regression tests for mixed and fully folded defaults, JSON text, prior-width/current-format catalogs, provenance rejection, budget failures and evaluator isolation. Validation: full planner/function/ByteJson suites with vet; focused final compatibility and temporal budget tests; lint reports zero issues. A service with predecessor scalar/JSON/width source overlays on current dependencies created 21 tables. Same-disk upgrade, metadata DUMP/LOAD and subsequent INSERT/UPDATE pass, with teardown verified. Two normal BVT rounds pass 47/47 each with zero ignored cases. This is source-overlay compatibility evidence, not a complete historical-release binary test. Addresses review 5601322358 on PR matrixorigin#30316. Related to matrixorigin#30227.
|
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: 3c49eba907fcdd17d6e1f2d10e5533c15e3e9546
Assessment: approve
Reviewed the complete 63-file delta, linked issue and all 44 discussion entries. Formatting and binder-owned catalog repair preserve explicit widths, frozen defaults, catalog ownership and exact DUMP validation. Prior findings, including the precision-8 CREATE/ALTER failure, are resolved by current source and execution evidence. No actionable findings remain.
Model: gpt-6-astra / xhigh
Session: 01a13dcf-1517-7f90-b3f9-c5f9f9e7031b · slot 0 · generation 1
Validation:
-
Evidence and discussion-assessment.json are retained under /home/xupeng/.local/state/mo-bot/jobs/b43b20301e26854c53fdfdbb/attempt-1. Source remained unchanged.
-
Isolation preflight passed. Native prerequisites were independently qualified against 200 input hashes, seven output hashes and the repository build owner's receipt.
-
Current-head execution passed 57 focused test roots and six COPY ALTER controls across five packages. Logs: focused-tests.jsonl and alter-controls.jsonl; receipts: 1793126552641314183-3.json and 1793126798352884227-4.json.
-
Retained suites, historical fixtures and benchmarks were qualified by source, command, exit and artifact hashes. The original precision-8 fixture passed at the current head in approximately 104 ms.
-
Final evidence audit passed: validation-audit.json, final-audit.log and receipt 1793126828377405005-4.json. Frozen CI reports successful enabled UT, SCA, build, coverage and BVT checks.
Limitations:
-
No independently qualified full-service historical-release upgrade or new live MySQL comparison. Historical producer fixtures use predecessor formatting owners on newer dependencies. CI case logs were unavailable; upgrade lanes were skipped.
-
Retained microbenchmarks show five-double JSON serialization increasing from approximately 200–205 to 261–279 ns, with unchanged allocations. They do not establish whole-workload performance; historical catalog reconstruction retains bounded per-resolution costs.
-
Expression-specific MySQL scalar-buffer rounding remains outside the accepted scope. This assessment does not close the linked issue's reporter verification.
❌ Left the queue ·
|
| Condition | Required by | |
|---|---|---|
| ✅ | #review-threads-unresolved = 0 |
GitHub branch protection |
| ✅ | github-review-approved |
GitHub branch protection |
The batch, tested in place
| Condition | Required by | |
|---|---|---|
| ❌ | any of: check-neutral = CI Required, check-skipped = CI Required, check-success = CI Required |
GitHub branch protection |
Requeued — the merge queue status continues in this comment ↓.
Times in UTC · dashboard · how the merge queue works
…e3709b19809c81226d8ade686e4d13b57b6ef8c
🚫 Left the queue3 h 16 min in the queue, with no time running CI. So far
Reason Pull request #30316 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.
Hint You should look at the reason for the failure and decide if the pull request needs to be fixed or if you want to requeue it. Merge conditions: 2 of 3 metThis pull request
The batch, tested in place
Tick the box to put this pull request back in the merge queue (same as
Times in UTC · dashboard · how the merge queue works |
…e3709b19809c81226d8ade686e4d13b57b6ef8c
…e3709b19809c81226d8ade686e4d13b57b6ef8c
What type of PR is this?
Which issue(s) this PR fixes:
Related to #30227; leave open for reporter verification.
What this PR does / why we need it:
Align FLOAT/DOUBLE scalar and JSON text notation with MySQL while preserving binary JSON numeric values/types and existing fulltext token spelling. Shared formatting remains bounded and stateless.
Repair execution-owned historical catalog expressions whose implicit DOUBLE-to-string casts were bound to width 32. Reconstruct the complete SQL origin before widening; preserve explicit CHAR widths, assignment limits, folded DEFAULT values, shared catalog trees and idempotence. Legacy DUMP admission reconstructs the same historical binder era.
Historical trees can omit implicit collation coercibility that current binding records. A private historical candidate can omit only missing implicit markers for supported revision-zero byte collations. Present/invalid, explicit, native and conflicting provenance remains exact; DUMP retains exact syntax provenance and the generic comparator is unchanged. Cancellation now propagates through the existing repair owner. The redundant single-use refinement dispatcher is removed.
Tests retain independent predecessor fixtures, actual expression execution, truncation/NULL/assignment controls, DUMP tamper rejection, source immutability, cancellation and native-collation boundaries. Ineligible explicit/direct controls assert whole-table immutability rather than requiring unrelated metadata upgrades.
Scope remains common exponent/JSON notation and safe implicit bounds. MySQL's expression-specific scalar buffer-width rounding is outside this change.
The current repair also reconstructs complete creation-session witnesses for historical folded DEFAULT expressions. Time-zone/locale probes use a private process, preserve stored constants and explicit widths, share one cancellation/work budget, and publish only after complete old/current tree proofs. The actual-conflict rebase preserves current DUMP JSON, temporal and DDL-column-scope eras; historical JSON text folding is a separate proof-only candidate, while current JSON admission and lazy consumer identities remain intact.
Catalog repair preserves the complete original CREATE column scope alongside catalog/ALTER scope, including NOT NULL and primary-key declarations. Session search first rejects impossible precision/type witnesses. For opaque folded boundaries, it pre-folds independent descendants and probes only session-dependent constant islands across supported zones/locales. Equivalent probes share evaluation while retaining every original binding candidate; a hint must still pass the complete SQL-origin and current-binding proofs. The shared work budget is unchanged. DUMP uses the same hints for float DEFAULT candidates while retaining exact supplied-payload verification and its configured limit.
COPY ALTER normalizes only its private live-source replay copy through the same catalog migration owners as planning. The normalization runs inside each replica preparation, including the fresh source used by main's second generation after concurrent writes. This preserves frozen DEFAULT values when old engine metadata and the repaired replacement use different implicit widths, while retaining source identity/version, freshness, retirement and foreign-key checks.
Compose historical float and integer/DECIMAL binding eras before normalizing execution-owned catalogs. Preserve folded DEFAULT constants, catalog ownership and exact origin checks. Metadata-only ALTER can persist the repaired expression; DUMP reconstructs that state from independently SQL-bound candidates under the original work budget, without normalizing supplied payloads.
Successful creation-session witnesses are shared across DEFAULTs within one table verification. Retain at most eight timezone/locale pairs; every expression still binds its own SQL, precision, era and scope and must pass complete origin/current-tree or supplied-payload checks. This avoids repeating expensive discovery for a second valid DEFAULT under the unchanged table-wide budget. Hints never cross table operations. DUMP retains its sensitivity analysis and unavailable-binding fallback.
Distinct creation sessions share immutable folded-island results within one table verification, keyed by the exact residual source, effective folding context, timezone identity and locale. Equality-safe negative fingerprints avoid repeated decoding and comparison; matching fingerprints still require full island comparison and each expression's own authoritative proof. Each probe uses its own stored and already-folded reading-session string payload lengths only as search-order information. No precision is inherited from another DEFAULT. A priority pass is bounded to a quarter of the remaining work and is skipped when every candidate ties; all candidates remain available to the unchanged fair search and full-binding fallback. Shape agreement cannot accept a candidate and shape disagreement cannot exclude one. The work cap remains 1M visits; optional memo retention stops at 32 MiB of charged bytes or 65,536 source/result records. Errors and partial folds are never cached, and no results survive the table operation.
Validation
3c49eba907fcdd17d6e1f2d10e5533c15e3e9546, rebased onto officialc4946bb74d43f0f777977507a5a7d0105e628bf2: all 22 PR patches remain (21 equivalent; one context adjustment). JSON_UNQUOTE retains main's native-string fast path and immediate result ownership, with the context-scoped historical numeric formatter on its nonstring fallback. Main's subject reuse, prefix validation and MORPC134 remain intact; no new wire capability.-short -tags=matrixone_test -p=2 -count=1 -timeout=300spass for./pkg/container/bytejson ./pkg/internal/bytejsonvalidate ./pkg/sql/plan/function ./pkg/sql/planwith default vet (0.642s / 0.929s / 8.225s / 66.241s). Focused JSON_UNQUOTE tests cover text/native values, NULL/masks, invalid/binary domains and output survival after inline/area input overwrite/free. Historical JSON DEFAULT fixtures, full catalog/DUMP origin/tamper checks and the 0–30 precision matrix pass. Incremental golangci-lint over the eight changed PR package directories reports 0 issues.-run '^TestORLikeSubjectReuse'consumer checks pass all 22 named roots in colexec, filter and table_scan (0.989s / 0.983s / 0.916s). Existing typed bounds, NULL/error, CASE, admission, invocation/reset and rollback controls cover composition with the additive function metadata API.b866788fa99616b928c6ce76b65865f6398482bdevidence for unchanged migration/replay sources: five owner packages passed, eight barrier-based COPY ALTER refresh cells passed, and same-disk SELECT/default INSERT/UPDATE/COPY ALTER/DUMP/LIKE/LOAD/restored DML preserved frozen values. The historical writer uses legacy width/format owners on current dependencies, not a full historical-release binary. Historical DEFAULT replay and concurrent refresh were separately exercised, not combined in a new live run. No service upgrade was rerun for this string-only fast path.Independent conflict design and final overall review:
gpt-6-astra / medium, PASS, zero unresolved material findings. No whole-workload performance claim is made.