Repository navigation
fix: preserve prepared Boolean math semantics - #28628
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? |
XuPeng-SH
left a comment
There was a problem hiding this comment.
Re-reviewed exact head cec5ce0 against main 44b7f90. COMMENT only for this self-authored PR.
Conclusion: no remaining concrete P0/P1/P2 blocker found in the current change. The prior direct-result regression is resolved in the implementation: SQL Boolean parameters carry SourceType without HasRuntimeType, so numeric overload rebinding can use Boolean provenance without converting an unrelated bare SQL result marker into a BOOL literal. Explicit protocol RuntimeType remains authoritative. The new frontend and embedded tests exercise direct markers before/after/between numeric siblings, TRUE/FALSE/NULL reuse, TEXT client metadata, and cached-plan immutability.
The FLOAT/DOUBLE conversion checks inactive and NULL rows before reading provenance, uses row-local/constant-aware kind lookup, maps Boolean transport values to 0/1, and leaves ordinary string parsing/warnings on the existing path. Malformed Boolean-tagged input fails explicitly. SIGN's numeric-context addition is scoped to a numeric value consumer. I found no new numeric-width/overflow policy, persistent format, wire field, shared mutable owner, or unbounded retained allocation introduced by this fix.
The historical Boolean precision-argument limitation in ROUND/TRUNCATE remains a separate baseline issue from the earlier review, not a newly demonstrated regression here. I do not treat optional expansion of that coverage as a blocker.
Evidence: current eleven-file diff, previous reviews and issue context, parameter production, specialization/source-domain selection, float conversion, provenance accessor, integration/BVT oracles and cleanup reviewed. Author-reported focused function/planner/frontend race tests and embedded SQL acceptance were considered as reported; I did not independently rerun native tests or BVT. At inspection, current-head Ubuntu UT/coverage, shared build and arm64 SCA were still in progress, so this is not a claim that CI is green or that historical failures are independently proven unrelated. No CI wait and no repository edits. Head/base were rechecked immediately before posting.
What type of PR is this?
Which issue(s) this PR fixes:
Fixes #28484
Follow-up to #28513: fixes the SQL PREPARE/EXECUTE Boolean acceptance failure
reported after that change merged.
What this PR does / why we need it:
SQL
EXECUTEtransports user-variable values through a text-shaped vector butretains their logical prepare-time category. The planner must use that
provenance for numeric consumers without changing the historical result domain
of a bare SQL
?projection.Before this fix,
TRUEinCAST(? AS DOUBLE),SIN(?), orACOS(?)could beparsed as an ordinary nonnumeric string and become zero in MySQL mode. Integer
consumers such as
ABS(?),ROUND(?), andSIGN(?)could reject the sameBoolean with an invalid cast. A Boolean value can also be reused across
executions, NULLs, ordinary strings, and direct-result/numeric sibling
expressions.
Design and implementation
SourceTypemetadata for overload rebinding;HasRuntimeTyperemains unset for a bare SQL result marker, preserving itsTEXT result metadata. Explicit COM_STMT runtime types remain authoritative.
overloads. The shared string-to-float conversion consults row-local
Boolean provenance and maps canonical Boolean transport values to
0/1.SQL strings such as
'true'stay on the existing string-coercion and warningpath; malformed values marked as Boolean fail explicitly.
Rowsin a per-iterationscope, so assertion failures cannot retain server-side result resources.
.agents/skills/mo-devnow documents changed-packagestatic checks and evidence-based CI/environment triage instead of requiring a
whole-repository SCA in every edit loop.
background-work change is introduced. Runtime plan copies remain isolated
from the cached prepared plan.
Test plan
Validated from a clean worktree rebased onto
origin/maincommit44b7f90ee1695831663c55288a537c03c15c00e0:pkg/sql/plan/function: Boolean FLOAT/DOUBLE casts, inactive rows, andnumeric math consumers; focused
-racepassed.pkg/sql/plan: numeric overload/source-type rebinding, direct-result domainisolation, cache-plan immutability, and existing prepared parameter tests;
focused
-racepassed.pkg/frontend: prepared execution/metadata and related reuse tests;focused
-racepassed.TestIssue27088PreparedDecimalCommonType: real embedded SQL PREPARE/EXECUTEcoverage for TRUE/FALSE/NULL/string/reuse, integer targets, JSON controls,
and the direct-parameter-before/after-numeric-sibling case passed in 9.5s
after the SCA cleanup fix.
prepare/numeric_contextchanges add the reported CAST/SIN/ACOS andABS/ROUND/SIGN reuse cases.
golangci-lintsqlclosecheckonpkg/tests/issues, with therepository CGo include paths, passed with
0 issues.quick_validate.py .agents/skills/mo-devandgit diff --checkpassed.CI was not awaited. The current PR's historical compose information-schema
failure and resource-heavy UT cancellation are outside the changed paths;
no unrelated test or catalog behavior was modified here.
Review status
The complete final diff was reviewed with GPT-6 medium after implementation.
No remaining P0/P1/P2 semantic, metadata, NULL/mask, reuse, lifecycle, or
performance blocker was identified.
Final head:
cec5ce0bc645f3d4a52450312a540541cb703e18.