liuboF2c opened a new issue, #17191:
URL: https://github.com/apache/doris/issues/17191

   ### Search before asking
   
   - [X] I had searched in the 
[issues](https://github.com/apache/doris/issues?q=is%3Aissue) and found no 
similar issues.
   
   
   ### Version
   
   1.2.2
   
   ### What's Wrong?
   
   Data precision is lost when using the CAST function to convert DOUBLE type 
to DECIMAL type. 133059.33 will be converted to 133059.32999999.
   
![image](https://user-images.githubusercontent.com/30886198/221509845-97bdcc45-abb7-4f10-ac77-f004267b9779.png)
   
   
![image](https://user-images.githubusercontent.com/30886198/221509899-abefb4f0-4fc2-4f44-931e-10b26379811e.png)
   
![image](https://user-images.githubusercontent.com/30886198/221510664-d777b38c-374c-4fa3-83f4-3f149a0f61ed.png)
   
   
   ### What You Expected?
   
   When using the CAST function to convert 133059.33 of the DOUBLE type to the 
DECIMAL type, it is still 133059.33
   
   
   ### How to Reproduce?
   
   _No response_
   
   ### Anything Else?
   
   SQL:
   
   SELECT
        CAST(ROUND(CAST(t_a_0.`C_8e43b548775420c62858337ce2152b8e` AS 
DECIMAL(10,8)), 8)  AS DECIMAL(10,8)) castRoundCast,
        ROUND(CAST(t_a_0.`C_8e43b548775420c62858337ce2152b8e` AS 
DECIMAL(10,8)), 8) roundCast,
        CAST(t_a_0.`C_8e43b548775420c62858337ce2152b8e` AS DECIMAL(10,8)) 
castDecimal,
        CAST(t_a_0.`C_8e43b548775420c62858337ce2152b8e` AS double) castDouble
   FROM
        `ds_f55411c9_0615_47dc_b9bb_1f2f055049b3` t_a_0 
   WHERE
        t_a_0.`C_8e43b548775420c62858337ce2152b8e` = '133059.33';
   
   ### Are you willing to submit PR?
   
   - [ ] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [X] I agree to follow this project's [Code of 
Conduct](https://www.apache.org/foundation/policies/conduct)
   


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