nextdreamblue opened a new issue, #38973: URL: https://github.com/apache/doris/issues/38973
### 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 master ### What's Wrong? CREATE TABLE `test` ( `id` int NOT NULL, `price` decimal(10,4) NULL ) ENGINE=OLAP UNIQUE KEY(`id`) DISTRIBUTED BY HASH(`id`) BUCKETS 1 PROPERTIES ( "replication_allocation" = "tag.location.default: 1" ); insert into test values(1, 256); MySQL [tmp]> set enable_nereids_planner = false; Query OK, 0 rows affected (0.00 sec) MySQL [tmp]> select IF (price, price, 0) from test; +------------------------------------------+ | if(CAST(`price` AS boolean), `price`, 0) | +------------------------------------------+ | 256.0000 | +------------------------------------------+ 1 row in set (0.01 sec) MySQL [tmp]> set enable_nereids_planner = true; Query OK, 0 rows affected (0.00 sec) MySQL [tmp]> select IF (price, price, 0) from test; ERROR 1105 (HY000): errCode = 2, detailMessage = (9.134.167.25)[E-255]Arithmetic overflow when converting value 256.0000 from type Decimal(10, 4) to type Int8   新优化器在这里处理上,类似转换和旧优化器不一样,这里根据最后的0需要把price类型推导为tinyint才行,如果写0.0,就能返回正确结果。 而在处理cast decimal tinyint的时候,tinyint有取值范围,导致报了上边的错误 ### What You Expected? 返回正确结果 ### 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