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

   another test case showing the cast is likely ok, at least the query gives 
expected value casting from string literal
   ```
   ❯ select cast('6.4053151420411946063694043751862251568' as decimal(38,37)) + 
1;
   +------------------------------------------------------------+
   | Utf8("6.4053151420411946063694043751862251568") + Int64(1) |
   +------------------------------------------------------------+
   | 7.4053151420411946063694043751862251568                    |
   +------------------------------------------------------------+
   ❯ select arrow_typeof(cast('6.4053151420411946063694043751862251568' as 
decimal(38,37)) + 1);
   +--------------------------------------------------------------------------+
   | arrow_typeof(Utf8("6.4053151420411946063694043751862251568") + Int64(1)) |
   +--------------------------------------------------------------------------+
   | Decimal128(38, 37)                                                       |
   +--------------------------------------------------------------------------+
   ```
   
   whereas numeric literal is casted forcibly to float first , which not 
expected as for me
   
   
   ```
   ❯ select cast(6.4053151420411946063694043751862251568 as decimal(38,37)) + 1;
   +-----------------------------------------+
   | Float64(6.405315142041195) + Int64(1)   |
   +-----------------------------------------+
   | 7.4053151420411954619510965656866521088 |
   +-----------------------------------------+
   1 row in set. Query took 0.002 seconds.
   ❯ select arrow_typeof(cast(6.4053151420411946063694043751862251568 as 
decimal(38,37)) + 1);
   +-----------------------------------------------------+
   | arrow_typeof(Float64(6.405315142041195) + Int64(1)) |
   +-----------------------------------------------------+
   | Decimal128(38, 37)                                  |
   +-----------------------------------------------------+
   ```
   


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