greedAuguria opened a new pull request, #22927:
URL: https://github.com/apache/datafusion/pull/22927

   ## Which issue does this PR close?
   
   Closes #22696.
   
   ## Rationale for this change
   
   `round()` coerced integer inputs through `Float64`, which loses precision 
for `Int64` values above 2^53 (`round(9007199254740993)` returned 
`9007199254740992.0`) and errors outright for `UInt64` values above `i64::MAX` 
(`round(18446744073709551615)` failed instead of being a no-op).
   
   ## What changes are included in this PR?
   
   Integers keep their own types through `round()`: the return type for integer 
inputs is the input type itself, making `round(x)` and `round(x, n >= 0)` 
identity-preserving for all integer values without a `Float64` round-trip. 
Existing negative-scale rounding semantics and float behavior are preserved.
   
   ## Are these changes tested?
   
   Yes — regression tests added for both reported cases (`cargo test -p 
datafusion-functions round`: 8 passed, 0 failed).
   
   ## Are there any user-facing changes?
   
   `round()` on integer inputs now returns the integer input type instead of 
`Float64`.
   


-- 
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]

Reply via email to