2010YOUY01 opened a new issue, #11252:
URL: https://github.com/apache/datafusion/issues/11252

   ### Describe the bug
   
   When a `BIGINT` typed column is comparing with a large `DOUBLE` literal, 
it's not evaluated correct if it's in where clause
   ```
   > create table t0(v0 BIGINT);
   0 row(s) fetched.
   Elapsed 0.003 seconds.
   
   > insert into t0 values (1),(2),(3);
   +-------+
   | count |
   +-------+
   | 3     |
   +-------+
   1 row(s) fetched.
   Elapsed 0.003 seconds.
   
   > select * from t0 where v0>1e100;
   Arrow error: Cast error: Can't cast value 1.0000000000000002e100 to type 
Int64
   ```
   But if this comparison clause is in `SELECT` clause, it can be evaluated 
successfully. Such inconsistency should be a bug.
   ```
   > select v0>1e100 from t0;
   
+------------------------------------------------------------------------------------------------------------------------+
   | t0.v0 > 
Float64(10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)
 |
   
+------------------------------------------------------------------------------------------------------------------------+
   | false                                                                      
                                            |
   | false                                                                      
                                            |
   | false                                                                      
                                            |
   
+------------------------------------------------------------------------------------------------------------------------+
   3 row(s) fetched.
   Elapsed 0.003 seconds.
   ```
   
   ### To Reproduce
   
   _No response_
   
   ### Expected behavior
   
   _No response_
   
   ### Additional context
   
   `PostgreSQL` and `DuckDB` can evaluate both queries successfully.
   
   Found by SQLancer https://github.com/apache/datafusion/issues/11030


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