Repository navigation
fix: truncate floating BIT_COUNT inputs before counting bits - #30307
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? |
b75eea3 to
104aa83
Compare
|
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: 104aa83d33c4f3618bd3f7f3400e31828091b5c6
Assessment: approve
Reviewed the complete four-file delta and affected callers. Floating BIT_COUNT truncation belongs in the existing shared conversion helper. The change preserves boundary clamps, NaN errors, NULL handling and other numeric domains while removing unreachable logic. No actionable defects or material validation gaps remain. No additional allocation, state, I/O or concurrency cost was identified.
Model: gpt-6-astra / xhigh
Session: 01a13dcf-1517-7f90-b3f9-c5f9f9e7031b · slot 0 · generation 1
Validation:
-
Verified the frozen head, merge-base and unchanged source; reconciled native-input provenance and successful repository-owned native build.
-
Passed 11 focused BIT_COUNT tests and all 2,084 top-level tests in pkg/sql/plan/function.
-
Passed two real SQL-session runs covering constants, projections, predicates, NULLs, SQL and binary prepared execution, and cleanup.
-
The regression test failed against the frozen-base function for both FLOAT and DOUBLE, then passed on the candidate.
-
go vet, formatting and diff checks passed. Commands, source fingerprints, exits and retained logs are reconciled in /home/xupeng/.local/state/mo-bot/jobs/4c320200bac1057c12762618/attempt-1/validation-audit.json; audit receipt 1792091370242251819-4.json records exit 0.
Limitations:
-
Local validation used Linux amd64 and a targeted real SQL probe, not the complete mo-tester result-file comparison. Raw CI and author validation logs were unavailable.
-
The linked issue body was absent; review assessed the supplied PR contract and regression examples.
-
No performance benchmark was run; the stateless conversion retains constant work per value.
Merge Queue Status
This pull request spent 1 hour 39 minutes 38 seconds in the queue, including 1 hour 2 minutes 16 seconds running CI. Required conditions to merge
|
…4fb97f60da4539bd92bad6dd784f0b203b4a6e3
What type of PR is this?
Which issue(s) this PR fixes:
What this PR does / why we need it:
BIT_COUNTrounds fractional FLOAT/DOUBLE values before counting bits. For example,BIT_COUNT(CAST(3.5 AS DOUBLE))returns 1 instead of MySQL's 2, and-3.5returns 62 instead of 63.Truncate FLOAT/DOUBLE inputs toward zero in their shared conversion helper and consolidate the signed conversion branch. Preserve existing saturation bounds, NaN errors, and architecture-safe negative integer conversion. DECIMAL keeps its existing rounding behavior. The conversion remains constant work per row with no allocations.
Extend the existing unit and SQL regressions for both floating types, signed fractions, zero/subunit values, NULL, clamp neighbors, prepared execution, and stored-column projections and filters. Retain integer, DECIMAL, string, and binary controls.
Validation on macOS arm64 with Go 1.27.1:
1 1 62 2 63; the fixed build returns2 2 63 2 63.TestBitCount*tests and the fullpkg/sql/plan/functionpackage pass with-count=1using the repository CGo wrapper.go vetand incrementalgolangci-lintpass (0 issues).mo-service; normal mo-tester comparison offunc_bit_count.testpasses twice on the same isolated standalone instance (100/100 statements each). Verified fixture tables are removed after each run.CI checks are pending. The issue remains open for the reporter to verify after merge.