xiedeyantu opened a new issue, #21318: URL: https://github.com/apache/datafusion/issues/21318
### Describe the bug When adding two `SMALLINT` values near the upper bound, the result appears to wrap around instead of raising an overflow error. ### To Reproduce ```sql select CAST(32767 AS SMALLINT) + CAST(2 AS SMALLINT); ``` In DuckDB, it will return the following: ``` Out of Range Error: Overflow in addition of INT16 (32767 + 2)! ``` But in datafusion, it will return the different result: ``` +-------------------------+ | Int64(32767) + Int64(2) | +-------------------------+ | -32767 | +-------------------------+ 1 row(s) fetched. Elapsed 0.005 seconds. ``` ### Expected behavior The query should fail with an overflow error. ### 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]
