Repository navigation
fix(function): treat BOOL as 1/0 next to FLOAT/DOUBLE in arithmetic and comparison - #31296
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: b159b634f840dc4c5a4e6942bbd9ecdaf80e86f0
Assessment: approve
Reviewed the complete four-file delta and affected callers. The fix correctly extends the existing coercion tables and reuses established DOUBLE casts and operators. Tests cover binding permutations, SQL results, metadata, NULLs and division by zero. No actionable findings or substantive discussion disputes remain.
Model: gpt-6-astra / xhigh
Session: 01a13dcf-1586-7a01-9000-d45e20995cf8 · slot 1 · generation 1
Validation:
-
Verified checkout, patch and frozen CI snapshot against the assigned head. CI reports successful build, UT, SCA, coverage, PROXY BVT and COMPOSE/PESSIMISTIC BVT; reviewed package and BVT routing.
-
Static audit passed: exactly eight new coercion cells; all 1,263 existing effective cells remain unchanged. Receipt: checks/1793027901945437359-2.json; retained output: source-evidence-audit.log.
-
Reviewed the 52 binding combinations and four-row SQL fixture, including expected values, metadata, predicates, NULLIF/IN and cleanup.
-
Saved discussion-assessment.json accounting for both informational discussion items, and review-notes.json with design, caller, performance and evidence analysis.
Limitations:
-
No local Go or SQL tests were rerun. Reused frozen candidate CI results; raw per-case CI logs and independently verifiable author execution artifacts were unavailable.
-
The standalone text of issue #31292 was absent; reviewed the concrete reproductions and behavioral contract supplied in the PR.
-
No performance benchmark was run. Existing lookup complexity and table sizes are unchanged; newly accepted expressions use existing vector casts.
|
Queued — the merge queue status continues in this comment ↓. |
aunjgr
left a comment
There was a problem hiding this comment.
Reviewed the BOOL/FLOAT arithmetic and comparison coercion and the associated controls at this commit. I found no blocking issues. I reused the passing CI results and did not run local tests.
🚫 Left the queue53 min in the queue, with no time running CI. So far
Reason Pull request #31296 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 |
What type of PR is this?
Which issue(s) this PR fixes:
Fixes #31292
What this PR does / why we need it:
Arithmetic and comparison between
FLOAT/DOUBLEandBOOLfailed to bind withbad value [DOUBLE BOOL]/[FLOAT BOOL]. Examples:1e0 + true,d > b, andnullif(1e0, true), which is lowered to=. MySQL treats TRUE/FALSE as 1/0, so these evaluate as DOUBLE.Root cause:
fixedBinaryCastRule1/fixedBinaryCastRule2hadBOOL × INT*/UINT*rows but noBOOL × FLOAT32/FLOAT64rows. TheBOOL → FLOATcast already exists (boolToFloat).Fix:
type_check.go+10 addsBOOL × FLOAT32/FLOAT64 → FLOAT64in both orders to rule tables 1 (+ - * % and comparisons) and 2 (/ DIV). The rows sit next to theT_anyrows, away from theBOOL × DECIMALrows that #31193 adds, so the two PRs don't conflict.Evidence
float_bool_arithmetic_test.go: 13 operators × {FLOAT, DOUBLE} × both orders. RED on main (bad value [FLOAT BOOL]), GREEN with the fix.go test ./pkg/sql/plan/function ./pkg/sql/planpass.operator/float_bool_arithmetic.sql: main 6/15, PR 15/15.1e0 + true1e0 - true, 2e0 * true, 3e0 / true, true + 1e0, true - 2.5e01e0 = true, 1e0 > false, 2e0 <> true, true < 2e0, true <=> 1e05e0 % true, 5e0 div true, true div 2e0f + b, d - b, d * b, f = b, d > b(f=1.5, d=2.5, b=true)nullif(1e0, true), nullif(2e0, true)git merge-treeagainst each is clean. I merged all of them locally (main + fix(function): allow BIT operands in AND/OR/XOR/NOT #31192 + fix(function): treat BOOL as 1/0 next to DECIMAL in arithmetic and comparison #31193 + fix(function): CASE/IF/IFNULL/COALESCE keep numeric type when a branch is BOOL #31201 + all 4 PRs of this batch) and ran every new BVT on that build: all green.Merge Danger
Low. This only adds rule rows for type pairs that used to fail to bind. No existing pair changes its resolution.