Skip to content

fix: honor IGNORE conversion warnings - #28740

Merged
XuPeng-SH merged 5 commits into
mainfrom
codex/issue-28680-ignore-conversion
Sep 12, 2026
Merged

XuPeng-SH merged 5 commits into
mainfrom
codex/issue-28680-ignore-conversion

Conversation

@XuPeng-SH

@XuPeng-SH XuPeng-SH commented Sep 11, 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:

Fixes #28680

What this PR does / why we need it:

The INSERT IGNORE / UPDATE IGNORE integer-assignment fallback used only
leading integer digits. It therefore stored 12 for 12.9tail and 1 for
1e2tail, silently discarding the fractional and exponent parts.

The assignment-only fallback now scans the complete decimal numeric prefix and
rounds it exactly, with ties away from zero, before applying the existing
target-width range checks. For example, 12.9tail stores 13, and 1e2tail
stores 100. It uses bounded integer arithmetic rather than float64, so
64-bit boundaries retain their precision and long exponents do not cause
exponent-sized allocations.

The change remains at the existing castModeAssignmentIgnore boundary.
Ordinary/explicit casts, binary inputs, extension numeric syntax, NULL and
inactive rows keep their existing paths. A true no-prefix lexical value keeps
the zero adjustment and 1366 diagnostic; an adjusted numeric prefix reports
1265; rounded values outside the target range remain range errors.

Validation

  • go test ./pkg/sql/plan/function -count=1 — passed after rebase.
  • go test ./pkg/sql/plan -count=1 — passed after rebase.
  • go test ./pkg/tests/issues -run '^TestIssue28680IgnoreConversionExecutionBoundaries$' -count=1 — passed against an isolated embedded cluster after rebase.
  • go test -race ./pkg/sql/plan/function -run 'TestAssignment(Ignore|Prefix)' -count=1 — passed after rebase.
  • go vet ./pkg/sql/plan/function and git diff --check — passed.
  • Extended the BVT case/result for direct INSERT/UPDATE and expected values/warnings. The exact mo-tester case was not run locally; CI BVT should verify its output.
  • GPT-6 medium overall and post-rebase reviews accepted the diff; the reviewer also cross-checked 100,000 generated decimal cases against exact rational rounding.

Risk and rollback

The runtime correction only affects integer assignment recovery in IGNORE
mode. Its arithmetic is linear in the input length with bounded numeric
storage; no new locks, waits, goroutines, or external work are introduced.
Reverting this PR restores the prior conversion behavior.

@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 →

@matrix-meow matrix-meow added the size/XL Denotes a PR that changes [1000, 1999] lines label Sep 11, 2026
@mergify mergify Bot added the kind/bug Something isn't working label Sep 11, 2026
@XuPeng-SH
XuPeng-SH force-pushed the codex/issue-28680-ignore-conversion branch from bbc9683 to ae121e2 Compare September 11, 2026 18:05

@XuPeng-SH XuPeng-SH left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Reviewed ae121e2 against main b731195. COMMENT only (self-authored); one concrete P2 remains.

[P2] Use assignment numeric conversion, not explicit-CAST integer-prefix conversion, for recovered INTEGER values. assignmentIntegerPrefix delegates to leadingDecimalIntegerPrefix, which discards the decimal fraction and exponent before the signed/unsigned recovery branches parse it. Thus CREATE TABLE t(i INT, u INT UNSIGNED); INSERT IGNORE INTO t VALUES ('12.9tail','1e2tail'); SELECT * FROM t; stores (12,1), whereas MySQL integer assignment stores (13,100), with truncation warnings. The added unsigned numeric prefix is retained test explicitly blesses the wrong 12 result for 12.9tail; the helper test likewise blesses 1 for 1e2tail. This is not merely warning text: it silently stores different numbers. The same fallback also loses the full numeric token before width/range validation.

MySQL's assignment owner Field_num::get_int calls strntoull10rnd, not the explicit CAST-style digit prefix: https://github.com/mysql/mysql-server/blob/8.4/sql/field.cc . Its implementation parses the fraction/exponent and rounds before checking the destination range: https://github.com/mysql/mysql-server/blob/8.4/strings/ctype-simple.cc#L1221-L1435 . Please preserve the complete decimal numeric prefix and perform checked assignment rounding (without a lossy float64 detour), then issue 1265 for discarded trailing text. Keep extension-syntax and genuine overflow policy separate. Add signed/unsigned fraction, exponent, half-boundary and out-of-range prefix controls via direct VALUES, prepared reuse and source-column paths.

Other closures inspected: target selection/protocol fallback; direct-parameter deferral versus compound numeric binding; row masks/NULLs and zero-match UPDATE; DECIMAL64/128/256 and temporal lexical classification; bounded warning messages and existing statement warning owner; binary/extension exclusions; rollback/non-IGNORE atomic-failure and prepared invalid/valid/invalid tests. No new shared state, waits or external per-row work. Full diff reviewed; reused reported owning-package and embedded protocol tests, but their current integer-prefix oracle does not close this counterexample. I did not execute MySQL/MO SQL or native suites, and did not wait for CI.

@XuPeng-SH XuPeng-SH left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Force re-review of f5fdaa9 against main e2580f9. COMMENT only (self-authored). The previous P2 is NOT closed.

[P2] Complete valid decimal/scientific strings still generate false truncation warnings. In pkg/sql/plan/function/func_cast.go the signed recovery at line 6585 and corresponding unsigned recovery still call appendTruncatedAssignmentConversionWarning unconditionally after successful rounding/range checking. assignmentIntegerPrefix still returns only integer/hasPrefix/error, without consumed extent or a trailing-data flag. Consequently CREATE TABLE t(i INT); INSERT IGNORE INTO t VALUES ('1e2'); SHOW WARNINGS; stores the correct 100 but incorrectly emits 1265. Complete 12.9 likewise stores 13 with a spurious warning. Repeated source rows or prepared INSERT/UPDATE executions therefore inflate diagnostics. The fraction and exponent numeric prefixes round UT still explicitly expects seven warnings, including these two complete-input controls.

This is not a stale-review assumption: exact Git blob IDs for all 13 current changed files match their counterparts at previously reviewed 71bab7c. The new commit SHA/rebase did not change the affected implementation or oracle. Please propagate consumed extent/has-non-whitespace-suffix from the numeric scanner, append 1265 only for discarded non-whitespace trailing data, and split the complete-token versus tail test expectations. Add prepared suffix -> complete -> suffix reuse to demonstrate warning reset. Preserve 1366 for no-prefix lexical input and the existing range-error policy.

The earlier wrong-value fix remains intact: complete decimal/exponent prefixes are rounded exactly, ties away from zero, before target-width validation. Revalidated signed/unsigned bounds, negative rounded zero, bounded long-exponent arithmetic, mode/binary/extension guards, NULL/inactive rows, direct-marker versus compound binding, UPDATE/no-match and prepared/column ownership, and existing warning/rollback paths. No additional confirmed blocker or new resource/concurrency regression. Normal integer-success paths avoid the recovery scan; recovery remains input-linear with bounded numeric scratch state.

Evidence/limits: current exact-head source and blob comparison, current PR comments/history and test-oracle inspection, with prior semantically unchanged package/race/embedded evidence reused. No new native/SQL suite or benchmark was run, and CI was not awaited. The PR explicitly says the exact expanded mo-tester BVT has not been executed locally; its expected-output file is not treated as execution proof.

@XuPeng-SH XuPeng-SH left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Re-reviewed head e6c32ab against main 0d701bb, including the full current diff and all three prior reviews. COMMENT only (self-authored). No remaining blocking finding.

The previous false-1265 finding is closed. assignmentIntegerPrefix now derives the consumed extent from the scanned token and classifies only a remaining non-whitespace suffix as truncation. Both signed and unsigned recovery publish 1265 conditionally. Complete 12.9 and 1e2 retain rounded results 13 and 100 without that warning; their tail variants still warn. The revised UT separates these oracles, and the real COM_STMT execution test covers suffix -> complete -> suffix reuse plus complete/suffixed exponent inputs, checking both diagnostics and stored rows.

The earlier wrong-value repair also remains intact: exact decimal/exponent rounding, ties away from zero, precedes destination-width checks. Reviewed signed/unsigned carry boundaries, MinInt64/MaxUint64, values beyond float64 precision, negative rounded zero, incomplete exponents, long mantissa/exponent cancellation and overflow. Numeric scratch storage is bounded; exponent saturation keeps work proportional to input length, including zero mantissas. Ordinary successful integer conversion avoids the recovery scanner. No new background work, wait, lock, wire field or persistent format is added; adjusted rows use the existing bounded diagnostic sink.

Other inspected closures: literal deferral and final assignment-cast selection, direct prepared markers versus compound numeric expressions, INSERT/UPDATE/INSERT SELECT ownership, NULL/inactive rows and zero-match UPDATE, DECIMAL64/128/256 and temporal lexical adjustment, existing binary-numeric and extension-syntax paths, non-IGNORE behavior, and rollback/atomic-failure assertions. This is an ordinary conversion bug fix; a separate feature design gate is not applicable.

Evidence: reused current-head run https://github.com/matrixorigin/matrixone/actions/runs/34690151782 — shared build, SCA, UT, coverage, both active multi-CN BVT jobs and CI Required completed successfully. Also inspected the focused helper, planner, protocol and BVT oracles and the author's reported package/race evidence. No additional native suite, MySQL comparison or benchmark was run in this review; there is no measured throughput claim.

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/XL Denotes a PR that changes [1000, 1999] lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Compatibility]: INSERT IGNORE and UPDATE IGNORE reject invalid integer and date values

2 participants