Repository navigation
fix(plan): preserve numeric UNION types with untyped NULL - #32461
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 discussion changed before publication; a fresh contextual review is queued. |
XuPeng-SH
left a comment
There was a problem hiding this comment.
发现 1 个需要修复的结果类型问题,详细复现见行内评论。其他已检查的数值、时间、嵌套集合以及显式类型 NULL 场景中,没有发现新的阻断问题;现有相关 planner 测试通过。额外的 CTAS planner 断言复现了此问题。历史上没有需要逐条关闭的人工 review 评论。
|
mo-bot review · Commit: "interrupted" |
|
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: beb2bae72cea473792910d8f750a5799ae3a4e0f
Assessment: approve
The fix uses shared set-operation reconciliation with bounded projection provenance, preserving numeric NULL semantics without a CTAS-specific workaround. Width reconciliation now excludes bare-NULL placeholders and precedes casts, addressing the prior P2 and mixed-string truncation. Typed inputs, derived-table boundaries and existing nullability rules remain intact. No actionable findings remain.
Model: gpt-6.1-sol / max
Session: 01a1a004-90c3-73b1-acc9-3d4636452003 · slot 0 · generation 0
Validation:
-
Reviewed all five changed files, affected binding/type/CTAS consumers, all six discussion entries and linked issue #32326.
-
Local static audit passed: frozen clean source, whitespace, gofmt, 86-statement SQL/result alignment and complete discussion coverage. Receipt: checks/1794309962570718205-4.json; log: review-audit.log.
-
Frozen-head CI records 12 successful checks, including UT, static analysis, coverage and proxy/pessimistic multi-CN BVT; 13 skipped and two neutral checks are not passes.
-
Assessed attributed focused/full planner, repeated BVT/CTAS runs and exact-hotfix baseline/MySQL 8.0.45 comparisons, including full-string values and DISTINCT cardinality.
Limitations:
-
No local Go/SQL runtime suites were repeated; local_validation is empty and raw author execution logs were not supplied.
-
Exact MySQL 8.0.44 and full expanded-suite MySQL comparisons were not established; existing conservative widths and genuine-derived-table differences remain outside this repair.
What type of PR is this?
Which issue(s) this PR fixes:
Fixes #32326
What this PR does / why we need it:
Bare
NULLprojections are defaulted to text before set-operation type reconciliation. Consequently, numericUNIONqueries and their CTAS consumers resolve to VARCHAR and sort lexicographically (NULL, 10, 2instead ofNULL, 2, 10).SELECT DISTINCT *wrapper used when folding repeated parenthesized UNION arms. This is limited to the synthetic wrapper and does not relax user-written derived-table type boundaries.Validation on macOS arm64 with Go 1.26.4 and native libraries built in the isolated worktree:
ef9256eca2c6436619272927e97f629af41ebd55, which already includes fix(plan): preserve CTAS output nullability on 4.1.6 hotfix #32085. The planner regression fails against unchanged baseline product code for numeric-versus-VARCHAR type mismatches.aefc868bb0, then verified numeric SELECT/CTAS types and ordering after the repair. Declared CHAR and genuine derived-table controls retain their existing string types.4d9e5d6566: seven scenarios failed for SELECT and CTAS with expected width 1/2 versus actual width 4. Left/right NULLs, nesting/folding, typed-NULL widths, real-string widening, and the all-NULL fallback now pass.e8e06ba2b1: the exact reported query returned NULL/a/a, CTAS stored VARCHAR(1), and DISTINCT produced only 2 rows. The original hotfix baseline and MySQL 8.0.45 retained abcdefgh and 3 rows. The repaired candidate matches MySQL for the exact witness, including full SELECT/CTAS values, VARCHAR(8) metadata, and DISTINCT cardinality. Seven of eight mixed-string planner scenarios failed before the repair; all eight now pass, including no-NULL, reversed-order, nested, folded-NULL, explicit-VARCHAR, and typed-NULL controls.a5a8ed45fc([4.1.6-hotfix] fix(index): fail open for NaN scalar ZoneMaps #32431); it remains the current base. Focused regression, the full planner package, incremental static checks, service build, and SQL/BVT checks were rerun for the latest repair.pkg/sql/planunit-test package passed through the controlled CGo wrapper. Changed production statement-block coverage: 100% (27/27); overall planner package coverage: 61.3%.This is a shared planner fix, not a CTAS-only cast workaround. No catalog/wire format or execution-operator changes are introduced. Validation used a single-CN instance; full CI, multi-CN testing, and exact MySQL 8.0.44 comparison were not run. Existing all-NULL fallback metadata differences, conservative conversion capacities in some branch orders, and broader derived-table compatibility are outside this repair; this PR does not claim complete MySQL schema-width equivalence.