Baymine opened a new issue, #66829: URL: https://github.com/apache/doris/issues/66829
### Search before asking - [x] I searched the issues and found no similar issue. ### Version master ### What's Wrong? Nereids FE constant folding unconditionally casts operands of ordered comparisons (`>`, `>=`, `<`, and `<=`) to `ComparableLiteral` after their children are folded. Functions such as `curtime()` fold to `TimeV2Literal`, which extends `Literal` but does not implement `ComparableLiteral`. As a result, expressions such as `curtime() >= '20:00:00'` can fail during planning with `ClassCastException`. ### What You Expected? Ordered comparisons whose folded operands do not implement `ComparableLiteral` should remain as predicates for later evaluation instead of crashing during FE constant folding. ### How to Reproduce? Run a query containing an ordered comparison over `curtime()`, for example: ```sql SELECT curtime() >= '20:00:00'; ``` ### Proposed Fix Guard ordered comparison folding by checking that both operands implement `ComparableLiteral`. Fold when both are comparable; otherwise preserve the rewritten comparison expression. -- 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]
