pchintar opened a new issue, #22696: URL: https://github.com/apache/datafusion/issues/22696
### Describe the bug ### Description `round()` currently exhibits incorrect behavior for large integer inputs. For Int64 values greater than 2^53 (9007199254740992), which is the largest integer exactly representable in Float64, round() loses precision and return a different value than the input even though rounding an integer with a non-negative scale should be a no-op. Example: ```sql SELECT round(arrow_cast(9007199254740993, 'Int64')); ``` Current output: ```text 9007199254740992.0 ``` Expected output: ```text 9007199254740993 ``` The returned value differs from the input even though no rounding is required. The same issue can be observed with the two-argument form: ```sql SELECT round(arrow_cast(9007199254740993, 'Int64'), 2); ``` Current output: ```text 9007199254740992.0 ``` Expected output: ```text 9007199254740993 ``` ### Related behavior with large UInt64 values For UInt64 values that exceed i64::MAX, round() fails even when the operation is effectively a no-op. Example: ```sql SELECT round(arrow_cast(18446744073709551615, 'UInt64')); ``` Current output: ```text DataFusion error: Execution error: round: UInt64 value 18446744073709551615 exceeds i64::MAX and cannot be rounded ``` Expected output: ```text 18446744073709551615 ``` Similarly: ```sql SELECT round(arrow_cast(18446744073709551615, 'UInt64'), 2); ``` Current output: ```text DataFusion error: Execution error: round: UInt64 value 18446744073709551615 exceeds i64::MAX and cannot be rounded ``` Expected output: ```text 18446744073709551615 ``` ### To Reproduce _No response_ ### Expected behavior _No response_ ### Additional context _No response_ -- 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]
