-
-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Fix casting decimal to decimal for high precision #16049
Conversation
let min_for_precision = 9_i128 | ||
.saturating_pow(1 + to_precision as u32) | ||
.saturating_neg(); | ||
let max_for_precision = 9_i128.saturating_pow(1 + to_precision as u32); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's pretty bizarre to me that someone wrote this logic. I guess the intention was to define the bounds as e.g. 999 for precision 3, but it completely misses that mark. Am I missing something?
@@ -50,7 +50,7 @@ def test_modulo() -> None: | |||
("value", "sqltype", "prec_scale", "expected_value", "expected_dtype"), | |||
[ | |||
(64.5, "numeric", "(3,1)", D("64.5"), pl.Decimal(3, 1)), | |||
(512.5, "decimal", "(3,1)", D("512.5"), pl.Decimal(3, 1)), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should have failed. New logic properly causes this to fail.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #16049 +/- ##
==========================================
- Coverage 80.96% 80.96% -0.01%
==========================================
Files 1386 1386
Lines 178385 178383 -2
Branches 3060 3060
==========================================
- Hits 144438 144431 -7
- Misses 33460 33465 +5
Partials 487 487
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
f3449c3
to
4dbd338
Compare
CodSpeed Performance ReportMerging #16049 will improve performances by 24.72%Comparing Summary
Benchmarks breakdown
|
Closes #16027