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

   ### 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
   
   2.0.5-rc02
   2.1.0-rc11
   
   ### What's Wrong?
   
   With nereids planner enabled, `date()` function will be rewritten. 
   But when a datetimev1 column is processed by `date()` function then compares 
to a date literal, typically equal to and less than equal, it goes wrong due to 
**padding the date literal with time '24:00:00'**, this datetime literal cannot 
pass range check when it comes to BE, because hour in a datetime literal must 
not be greater than 23
   
   <br />
   
   code location:
   
   
   
   org.apache.doris.nereids.trees.expressions.literal.DateLiteral
   ```java
       public DateTimeLiteral toEndOfTheDay() {
           return new DateTimeLiteral(year, month, day, 24, 0, 0);
       }
   ```
   
   be/src/vec/runtime/vdatetime_value.cpp
   ```cpp
   bool VecDateTimeValue::check_range(uint32_t year, uint32_t month, uint32_t 
day, uint32_t hour,
                                      uint32_t minute, uint32_t second, 
uint16_t type) {
       bool time = hour > (type == TIME_TIME ? TIME_MAX_HOUR : 23) || minute > 
59 || second > 59;
       if (type == TIME_TIME) {
           return time;
       } else {
           return time || check_date(year, month, day);
       }
   }
   ```
   
   ### What You Expected?
   
   datetimev1 column works well in nereids planner
   
   ### 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: [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