Repository navigation
fix(function): GREATEST/LEAST accept BOOL mixed with numeric or string arguments - #31297
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: 33ece5d547cc0c6b0bd92db1740d251c9ada8937
Assessment: approve
Mixed-BOOL resolution correctly reuses existing promotion and cast paths, preserves unsigned range and NULL behavior, and leaves BOOL-only calls unchanged. No actionable findings remain.
Model: gpt-6-astra / xhigh
Session: 01a1869d-820c-7212-9788-aecfb86a4141 · slot 0 · generation 2
Validation:
-
36 focused LEAST/GREATEST tests passed across function and planner packages.
-
Full function-package tests passed; changed Go files are gofmt-clean.
-
Reused frozen exact-head successful UT, SCA, and active BVT-group evidence.
-
Receipts and retained logs reconciled in validation-evidence.json; source unchanged and discussion coverage complete.
Limitations:
-
No local service BVT run; individual CI case logs were unavailable.
-
BOOL-to-DECIMAL remains unsupported, as explicitly assigned to the separate dependency in the linked issue.
🚫 Left the queue7 min in the queue, with no time running CI. So far
Reason Pull request #31297 has been dequeued by @MatrixAdventurer with a Requeued — the merge queue status continues in this comment ↓. Times in UTC · dashboard · how the merge queue works |
|
@Mergifyio dequeue 已获批准(感谢 review),但本 PR 不在本轮授权合并清单内,先移出合并队列,由 LW 确认后再入队。 本操作由 LW 授权的 Grok Bot 智能体执行 |
|
@Mergifyio requeue 本操作由 LW 授权的 Grok Bot 智能体执行 |
🚫 Left the queue14 min in the queue, with no time running CI. So far
Reason Pull request #31297 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 |
☑️ This pull request is already queued |
What type of PR is this?
Which issue(s) this PR fixes:
Fixes #31293
What this PR does / why we need it:
GREATEST/LEASTrejected aBOOLargument mixed with any other type withbad value [BIGINT BOOL]/[DOUBLE BOOL]/[VARCHAR BOOL]. MySQL treats TRUE/FALSE as 1/0:GREATEST(2, TRUE)is 2, andGREATEST('a', TRUE)is 'a' (string comparison with '1').Root cause:
resolveLeastGreatestTypehad no rule for BOOL next to another type. BOOL isn't numeric forleastGreatestCommonNumericType/leastGreatestStringMixedType.Fix:
func_builtin_leastgreatest.go+57 addsresolveLeastGreatestMixedBool, which works like the existing ENUM normalization:GREATEST(uint64_col, TRUE)out of the signed/unsigned DECIMAL widening.GREATEST(1.5, TRUE)andLEAST(TRUE, uint64, int). fix(function): treat BOOL as 1/0 next to DECIMAL in arithmetic and comparison #31193 (for [Bug]: DECIMAL arithmetic/comparison with a BOOL operand fails with 'bad value [DECIMAL64 BOOL]' #31181) addsBOOL → DECIMAL. With fix(function): treat BOOL as 1/0 next to DECIMAL in arithmetic and comparison #31193 merged locally,greatest(1.5, true)= 1.5 andleast(1.5, true)= 1.0 with no further change.Evidence
least_greatest_bool_test.go: 9 mixed cases × {greatest, least} RED on main (bad value [BIGINT BOOL]), GREEN with the fix, plus a BOOL-only control. AllTestLeastGreatest*pass, and so dogo test ./pkg/sql/plan/function ./pkg/sql/plan.function/func_least_greatest_bool.sql: main 6/14, PR 14/14.greatest(2, true), least(2, true), greatest(true, 0), least(false, 3)greatest(1e0, true), least(0.5e0, true)greatest('a', true), least('a', true)greatest(d, b), least(f, b)(d=2.5, f=1.5, b=true)greatest(true, false)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. Only calls that used to fail to bind are affected: BOOL mixed with other types. BOOL-only and non-BOOL calls take exactly the same path as before.