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

   ### 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
   
   doris 1.2.2 release
   doris 2.0.0
   
   ### What's Wrong?
   
   建表语句
   CREATE TABLE `round_test` (
     `id` VARCHAR(100) NULL,
     `f1` FLOAT NULL,
     `f2` DOUBLE NULL,
     `f3` DECIMAL(9, 1) NULL,
     `f4` DECIMALV3(9, 1) NULL
   ) ENGINE=OLAP
   DUPLICATE KEY(`id`)
   COMMENT 'OLAP'
   DISTRIBUTED BY HASH(`id`) BUCKETS 3
   PROPERTIES (
   "replication_allocation" = "tag.location.default: 1",
   "in_memory" = "false",
   "storage_format" = "V2",
   "disable_auto_compaction" = "false"
   );
   插入数据
   INSERT INTO round_test 
VALUES('1',1.5,1.5,1.5,1.5),('2',2.5,2.5,2.5,2.5),('3',13.5,13.5,13.5,13.5),('4',14.5,14.5,14.5,14.5);
   查询数据
   SELECT id,f1 f1_float,ROUND(f1),f2 f2_double,ROUND(f2),f3 
f3_decimal,ROUND(f3),f4 f4_decimalv3,ROUND(f4) FROM round_test;
   查询结果
   
在FLOAT,DOUBLE,DECIMAL类型,**当整数位为偶数时,小数位为0.5的情况下,使用ROUND函数四舍五入会向下舍掉**,在整数位为奇数时正常;DECIMALV3类型正常;
   
`+----+----------+-------------+-----------+-------------+------------+-------------+--------------+-------------+
   | id | f1_float | round(`f1`) | f2_double | round(`f2`) | f3_decimal | 
round(`f3`) | f4_decimalv3 | round(`f4`) |
   
+----+----------+-------------+-----------+-------------+------------+-------------+--------------+-------------+
   | 1  |      1.5 |           2 |       1.5 |           2 | 1.5        |       
    2 | 1.5          | 2           |
   | 2  |      2.5 |           2 |       2.5 |           2 | 2.5        |       
    2 | 2.5          | 3           |
   | 3  |     13.5 |          14 |      13.5 |          14 | 13.5       |       
   14 | 13.5         | 14          |
   | 4  |     14.5 |          14 |      14.5 |          14 | 14.5       |       
   14 | 14.5         | 15          |
   
+----+----------+-------------+-----------+-------------+------------+-------------+--------------+-------------+`
   
![a2b68a2033dc9e50b89e5f9de513c06f](https://user-images.githubusercontent.com/20136048/233329404-0535a54c-2c24-48b2-a093-5235b5fb3856.png)
   Doris旧版本是正常的
   
https://doris.apache.org/zh-CN/docs/dev/sql-manual/sql-functions/math-functions/round/
   
![b114fa7b915831781bc80a7666f06167](https://user-images.githubusercontent.com/20136048/233331096-1517ffb3-2f03-4b57-b111-b51ec6bd2e78.png)
   
   
   
   
   
   ### What You Expected?
   
   在1.2.2和后续新版本能够保持对float、double、decimal进行round运算准确性的兼容
   
   ### How to Reproduce?
   
   _No response_
   
   ### Anything Else?
   
   _No response_
   
   ### 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: commits-unsubscr...@doris.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to