Repository navigation
fix(sql): handle invalid DECIMAL casts and quoted ADD INDEX backfills - #31289
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? |
5358887 to
015e89f
Compare
015e89f to
e4afe4e
Compare
|
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: dd079336ba076895a3ffc1d93f0169f191143208
Assessment: approve
Reviewed the complete 14-file delta and affected callers. DECIMAL recovery reuses existing parsing, diagnostics and statement-context owners while preserving strict-DML rejection. Identifier escaping covers both index-backfill generators. Updated tests retain genuine failure and recovery oracles. No actionable defects remain; both frozen discussion items are informational.
Model: gpt-6-astra / xhigh
Session: 01a13dcf-1517-7f90-b3f9-c5f9f9e7031b · slot 0 · generation 1
Validation:
-
Reused frozen exact-head successes for shared build, Ubuntu/x86 UT, Linux/arm64 SCA, UT coverage, Compose/Proxy BVT, multi-CN pessimistic BVT and CI Required.
-
Traced null/masked rows, prefix conversion and overflow, strict/loose/IGNORE context, folding protections, prepared recovery and backfill execution.
-
Local diff and Go-format checks passed; source remained unchanged. Receipt checks/1793031814546081392-5.json matches review-check.log.
-
Saved discussion-assessment.json, validation-audit.json and review-analysis.json under /home/xupeng/.local/state/mo-bot/jobs/c947778763b6d5c4e2519dea/attempt-1.
Limitations:
-
No local native tests or MySQL oracle were repeated. The frozen bundle contains CI outcomes but no raw per-case logs or retained author validation receipts.
-
Strict-DML error-code differences and special numeric syntax retain their documented prior behavior; broader MySQL parity is not claimed.
-
Valid cast paths are unchanged; lexical recovery adds parsing and warning work. Backfill escaping adds small per-statement scans. No performance measurements are claimed.
Merge Queue Status
This pull request spent 1 hour 43 minutes 31 seconds in the queue, including 1 hour 9 seconds running CI. Required conditions to merge
|
What type of PR is this?
Which issue(s) this PR fixes:
issue #30417
issue #31080
What this PR does / why we need it:
#30417 — explicit CAST(text AS DECIMAL) lexical leniency, scoped to SELECT / loose / IGNORE
Previously an explicit
CAST('<bad text>' AS DECIMAL)always failed with20301
invalid input ... is invalid decimal stringin every sql_mode andstatement kind, diverging from MySQL 8.0. The three precision paths
(strToDecimal64/128/256) now, for castModeExplicit lexical failures, return
the MySQL result: numeric prefix value (or
0when none) plus warning 1292Truncated incorrect DECIMAL value. Special numeric syntax (Inf/NaN/radixhex) is outside this lexical-fallback change and retains its existing
behavior unchanged; this PR makes no general MySQL-parity claim for it.
Strict-DML boundary (verified against a dedicated
mysql:8.0.46oraclecontainer, full matrix in artifacts): MySQL escalates that truncation warning
to an error for non-IGNORE data-modifying statements under strict sql_mode.
The fallback therefore applies leniency only for SELECT and loose / IGNORE
sessions. Non-IGNORE
INSERT/UPDATEunderSTRICT_TRANS_TABLESreuses theexisting diagnostic channel (
proc.IsDMLStatement() && isStrictSqlMode(proc) && !statementIgnore(proc), same gate asdiagnoseFloatText) and keepsrejecting with 20301 — matching the pre-PR baseline verified on clean main
e033d4a (all five strict/loose DML forms previously failed with 20301). The
1292-vs-20301 error-code difference on that path pre-exists this PR.
Two pre-existing
dtype/decimal.testcases(
10.0 + CAST('aaa' AS decimal(38,0)),CAST('' AS decimal(38,0))) carriedmain's old 20301 golden and failed in CI after the leniency change; their
expected results are synchronized to the new behavior in this PR (together
with the func_cast golden updated earlier). This is an expectation sync, not a
behavior carve-out.
#31080 — escape backticks in generated index backfill SQL
ALTER TABLE \tick``table` ADD INDEXre-parses internally generated backfill/marker INSERT SQL fromgenInsertIndexTableSql*without escaping ``→, breaking quoted identifiers. Both with/without-pkeybranches and the master-index variant now escape; UT + BVT cover default and
COPY algorithms.
Validation
TestExplicitCastLexicalDecimalDiagnostics,TestExplicitCastLexicalStrictDMLEscalation(DECIMAL64/128/256 × strictselect / strict insert / strict insert-ignore / strict update / generic DML
/ loose insert),
TestGenInsertIndexTableSql_EscapesBacktickIdentifiers;owning package
pkg/sql/plan/functionsweep passed on the rebased lineage.remains pending on the current HEAD's CI: func_cast.test 374/374, secondary_index_alter.sql 85/85,
count_derived_sort.sql 36/36, dtype/decimal.test 690/690 after the golden
sync — two consecutive rounds each, 0 failed, zero leftover databases.
static-check-selectedon./pkg/sql/compile ./pkg/sql/plan ./pkg/sql/plan/function ./pkg/tests/issues
./pkg/tests/sqlintegration): 0 issues;
git diff --checkclean.loose CTAS warns and writes 0.00; strict INSERT...SELECT with bad rows
filtered out writes valid rows/NULL without warnings.
dd079336bais pending. The previous run's multi-CNBVT failure was the stale decimal.test golden fixed here (690/690 twice
locally on final binary). The CI UT failure
TestTemporaryTablePhysicalNameIsSessionScopedwas selected locally with-runand-count=2and both runs passed — the CI RC-mode retry failurewas not reproduced locally. A same-fingerprint failure was also observed on
another PR's run (fix(load): restore large CSV rows and preserve LOCAL upload errors #31300, error path ISCP ProcessInitSQL / alter reindex ft
fulltext2 force_sync -> drop_at UPDATE -> txn need retry in rc mode), so it
is recorded as a suspected shared baseline RC-retry, unverified against a
clean-main reproduction; current run's verdict is pending CI.