YuvrajVerma09arch opened a new pull request, #27819: URL: https://github.com/apache/datafusion/pull/27819
Closes #27787 round and trunc returned NaN for finite inputs when the decimal precision was extreme. A positive factor overflowed to infinity and a negative factor underflowed to zero, so the scaling arithmetic produced infinity divided by infinity or zero divided by zero. In trunc an i64 precision was also cast to i32, so 2147483648 wrapped negative. This adds guards in the private helpers: an infinite factor returns the finite input, a zero factor returns signed zero, and i64 precision is clamped before the i32 cast. Both the hoisted array path and the per row path use the same helpers. The decimal paths are unchanged. Unit tests and math.slt cases cover extreme positive and negative precision for float32 and float64, plus the i64 overflow case. The focused tests, the full datafusion functions crate tests and math.slt pass; formatting and crate scoped clippy are clean. The workspace wide extended suite could not be run locally because a C++ toolchain dependency failed to build; CI will cover it. AI Disclosure This contribution is human supervised and task specific. AI assistance was used for codebase analysis, drafting the regression tests and drafting this description. The human contributor reviewed and understood every changed line and ran the verification commands. Known out of scope: a finite but very large scaling factor can still overflow the multiplication to infinity for some inputs. This change addresses the NaN cases reported in the issue. -- 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]
