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

   ### Describe the bug
   
   ```
   External error: query result mismatch:
   [SQL] SELECT + 99 * NULLIF ( 86, - CASE WHEN NOT COUNT ( * ) BETWEEN 84 AND 
54 THEN NULLIF ( - 59, COUNT ( * ) ) + CAST ( NULL AS REAL ) END ) / 48 + 27 * 
COALESCE ( + 76 * 67, 96 * 80 + 38, 13 * COUNT ( * ) )
   [Diff] (-expected|+actual)
   -   137661
   +   137661.38
   at test_files/sqlite/random/expr/slt_good_47.slt:10707
   ```
   
   datafusion
   ```sql
   > SELECT + 99 * NULLIF ( 86, - CASE WHEN NOT COUNT ( * ) BETWEEN 84 AND 54 
THEN NULLIF ( - 59, COUNT ( * ) ) + CAST ( NULL AS REAL ) END ) / 48 + 27 * 
COALESCE ( + 76 * 67, 96 * 80 + 38, 13 * COUNT ( * ) );
   
+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
   | Int64(99) * nullif(Int64(86),(- CASE WHEN NOT count(*) BETWEEN Int64(84) 
AND Int64(54) THEN nullif(Int64(-59),count(*)) + NULL END)) / Int64(48) + 
Int64(27) * coalesce(Int64(76) * Int64(67),Int64(96) * Int64(80) + 
Int64(38),Int64(13) * count(*)) |
   
+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
   | 137661.38                                                                  
                                                                                
                                                                                
           |
   
+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
   ```
   
   duckdb and postgres:
   
   ```sql
   D SELECT + 99 * NULLIF ( 86, - CASE WHEN NOT COUNT ( * ) BETWEEN 84 AND 54 
THEN NULLIF ( - 59, COUNT ( * ) ) + CAST ( NULL AS REAL ) END ) / 48 + 27 * 
COALESCE ( + 76 * 67, 96 * 80 + 38, 13 * COUNT ( * ) );
   
┌──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
   │ (((+(99) * "nullif"(86, -(CASE  WHEN ((NOT (count_star() BETWEEN 84 AND 
54))) THEN (("nullif"(-59, count_star()) +.  │
   │                                                        double              
                                          │
   
├──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
   │                                                                            
                               137661.375 │
   
└──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
   ```
   I cannot determine why df is rounding the result to 2 decimal places.
   
   ### To Reproduce
   
   sql above.
   
   ### Expected behavior
   
   results match other databases
   
   ### 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