yujun777 opened a new pull request, #47036: URL: https://github.com/apache/doris/pull/47036
### What problem does this PR solve? Issue Number: close #xxx Related PR: #xxx Problem Summary: PR do two things: 1. simplify cast date like from high scale to small scale. example: ``` # suppose c_datetime_2 is datetime(2) cast(c_datetime_2 as date) = '2020-12-20' ---> c_datetime_2 >= '2020-12-20 00:00:00.00' and c_datetime_2 <= '2020-12-20 23:59:59.99' cast(c_datetime_2 as datetime(1)) > '2020-12-20 12:34:56.7' --> c_datetime_2 > '2020-12-20 12:34:56.79' ``` 2. handle compare date like with overflow. before this PR, it will not simplify if met overflow, but this PR will simplify too. example: ``` # suppose c_datetime_2 is datetime(2), c_date is date cast(c_date as datetime) < '9999-12-31 23:59:59' --> c_date <= '9999-12-31' cast(c_date as datetime) >= '9999-12-31 23:59:59' --> c_date > '9999-12-31' cast(c_datetime_2 as datetime(3)) < '9999-12-31 23:59:59.995' --> c_datetime_2 <= '9999-12-31 23:59:59.99' cast(c_datetime_2 as datetime(3)) >= '9999-12-31 23:59:59.995' --> c_datetime_2 > '9999-12-31 23:59:59.99' ``` ### Release note None ### Check List (For Author) - Test <!-- At least one of them must be included. --> - [ ] Regression test - [ ] Unit Test - [ ] Manual test (add detailed scripts or steps below) - [ ] No need to test or manual test. Explain why: - [ ] This is a refactor/code format and no logic has been changed. - [ ] Previous test can cover this change. - [ ] No code files have been changed. - [ ] Other reason <!-- Add your reason? --> - Behavior changed: - [ ] No. - [ ] Yes. <!-- Explain the behavior change --> - Does this need documentation? - [ ] No. - [ ] Yes. <!-- Add document PR link here. eg: https://github.com/apache/doris-website/pull/1214 --> ### Check List (For Reviewer who merge this PR) - [ ] Confirm the release note - [ ] Confirm test cases - [ ] Confirm document - [ ] Add branch pick label <!-- Add branch pick label that this PR should merge into --> -- 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 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