findepi opened a new issue, #17539:
URL: https://github.com/apache/datafusion/issues/17539

   ### Describe the bug
   
   In programming languages it's rather typical that numeric overflows are not 
a runtime error.
   
   In SQL, it's rather typical that numeric overflows are identified during 
query execution and are treated as an error. 
   
   DataFusion is a SQL engine and therefore should report overflows as query 
errors. Continuing execution after overflows happened is a correctness issue 
(query results a wrong result).
   
   ### To Reproduce
   
   ```shell
   cargo run --bin datafusion-cli -- --command "SELECT 10000000000 * 
10000000000;"
   ```
   
   ```
   datafusion main$ cargo run --bin datafusion-cli -- --command "SELECT 
10000000000 * 10000000000;"
       Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.17s
        Running `target/debug/datafusion-cli --command 'SELECT 10000000000 * 
10000000000;'`
   DataFusion CLI v50.0.0
   +-----------------------------------------+
   | Int64(10000000000) * Int64(10000000000) |
   +-----------------------------------------+
   | 7766279631452241920                     |
   +-----------------------------------------+
   ```
   
   
   
   ### Expected behavior
   
   ### PostgreSQL
   
   ```
   postgres=# SELECT 10000000000 * 10000000000;
   ERROR:  bigint out of range
   ```
   
   ### Trino
   ```
   trino> SELECT 10000000000 * 10000000000;
   Query 20250912_093345_00000_kgiyz failed: bigint multiplication overflow: 
10000000000 * 10000000000
   ```
   
   ### Snowflake
   ```
   SELECT 10000000000 * 10000000000 * 10000000000 * 10000000000;
   -- Number out of representable range: type FIXED[SB16](38,0){not null}, 
value 1e+40
   ```
   
   ### 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: github-unsubscr...@datafusion.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org
For additional commands, e-mail: github-h...@datafusion.apache.org

Reply via email to