comphead commented on issue #6828:
URL: 
https://github.com/apache/arrow-datafusion/issues/6828#issuecomment-1656491917

   Adding more test cases to be validated on DF
   
   Looks like there is a series of bugs on decimal multiply/division in DF, so 
this qury in PG gives me all the same numbers
   ```
   select cast(6.4053151420411946063694043751862251568 as decimal(38,37)) / 1,
          cast(6.4053151420411946063694043751862251568 as decimal(38,37)) / 1.0,
          cast(6.4053151420411946063694043751862251568 as decimal(38,37)) * 1,
          cast(6.4053151420411946063694043751862251568 as decimal(38,37)) * 1.0
   
   6.40531514204119460636940437518622515680
   ```
   
   
   
   in DF division not happening at all, multiply gives diff results
   ```
   ❯ select cast(6.4053151420411946063694043751862251568 as decimal(38,37)) / 1;
   Optimizer rule 'simplify_expressions' failed
   caused by
   Arrow error: Compute error: Overflow happened on: 
64053151420411946063694043751862251568 * 100000000000000000000000000000000000000
   ❯ select cast(6.4053151420411946063694043751862251568 as decimal(38,37)) / 
1.0;
   Optimizer rule 'simplify_expressions' failed
   caused by
   Arrow error: Compute error: Overflow happened on: 
64053151420411946063694043751862251568 * 100000000000000000000000000000000000000
   ❯ select cast(6.4053151420411946063694043751862251568 as decimal(38,37)) * 1;
   +---------------------------------------------------------------------------+
   | Decimal128(Some(64053151420411946063694043751862251568),38,37) * Int64(1) |
   +---------------------------------------------------------------------------+
   | 6.4053151420411946063694043751862251568                                   |
   +---------------------------------------------------------------------------+
   1 row in set. Query took 0.002 seconds.
   ❯ select cast(6.4053151420411946063694043751862251568 as decimal(38,37)) * 
1.0;
   
+-------------------------------------------------------------------------------------------+
   | Decimal128(Some(64053151420411946063694043751862251568),38,37) * 
Decimal128(Some(10),2,1) |
   
+-------------------------------------------------------------------------------------------+
   | -0.40033219637757466289808777344913907232                                  
               |
   
+-------------------------------------------------------------------------------------------+
   1 row in set. Query took 0.002 seconds.
   ```
   


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

Reply via email to