kumarUjjawal commented on PR #19926: URL: https://github.com/apache/datafusion/pull/19926#issuecomment-3780277725
> > Other options considered: > > ``` > > 1. Increase output precision by 1 (PostgreSQL behavior): The `return_type` should increase precision by 1 to accommodate potential carry-over from rounding. For `DECIMAL(p, s)` with `decimal_places=0`, return `DECIMAL(p+1, s)`. > > > > 2. Return error on overflow: Keep same precision but return an error when the rounded value exceeds the precision (current code uses mul_checked but the overflow happens silently in display). > > > > 3. Dynamic precision based on scale reduction: When reducing scale (e.g., from 1 to 0), calculate the minimum precision needed. > > ``` > > > > > > > > > > > > > > > > > > > > > > > > I chose option 1 as the most user friendly, I would like to hear if there are other suggestion for this fix. > > Option 1 sounds good. Option 2 would be too strict, not sure I fully understand what option 3 means here. > > One thing to keep in mind is we still need to consider edge case where precision is already maxed out. Would this bug occur again? You were right to point that, i did some more test and found out it was overflowing after 38 digits, I handled that as an error. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
