Repository navigation
fix: decimal comparison precision handling and add range validation for type casting and div operator improvement - #23440
Conversation
PR Compliance Guide 🔍Below is a summary of compliance checks for this PR:
Compliance status legend🟢 - Fully Compliant🟡 - Partial Compliant 🔴 - Not Compliant ⚪ - Requires Further Human Verification 🏷️ - Compliance label |
||||||||||||||||||||||||
PR Code Suggestions ✨Explore these optional code suggestions:
|
||||||||||||||||||
715eea9 to
7132d19
Compare
Merge Queue Status✅ The pull request has been merged at 47c0a11 This pull request spent 55 minutes 12 seconds in the queue, including 55 minutes running CI. Required conditions to merge
|
User description
What type of PR is this?
Which issue(s) this PR fixes:
issue #23439 #23404
What this PR does / why we need it:
1. Fix Decimal128 High-Bit Handling (Critical)
hasTrailingZeros()only checked low 64 bits of Decimal128, ignoring high bitsdecimal128HasTrailingZeros()using proper 128-bit modulo arithmetic2. Add Integer Range Validation (Critical)
canUse()function allowed unsafe type casting without range checksuint8column vs20000constant → overflow erroruint32column vs-1constant → negative value errorcheckNoNeedCast()validation for integer and float types3. Fix Float Precision Limits (Medium)
4. Add Early Detection for Decimal Comparisons (Medium)
price = 99.991234567(column scale=2) → always falseprice <> 99.991234567→ always true5. Skip Constant Folding for Division by Zero (Medium)
6. Smart Type Selection for Decimal Literals (Low)
Performance Impact