findepi commented on issue #13492:
URL: https://github.com/apache/datafusion/issues/13492#issuecomment-2488378616

   > But if we cast it to a larger decimal and then cast it down to (6,2), then 
DataFusion cast works fine and looses precision. As shown below
   > 
   > ```scala
   > > select cast( cast(12345.6789 as decimal(24,2)) as  decimal(6,2));
   > +---------------------+
   > | Float64(12345.6789) |
   > +---------------------+
   > | 1234.56             |
   > +---------------------+
   > ```
   
   Losing decimal digits (rounding) in a cast is OK.
   
   However here the cast  _changes value_ fundamentally, losing digits before 
the decimal dot, which is not OK.
   The original value was ≈12345, the cast result is ≈1234.
   
   


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