alanredsheep opened a new issue, #9296:
URL: https://github.com/apache/incubator-doris/issues/9296

   ### Search before asking
   
   - [X] I had searched in the 
[issues](https://github.com/apache/incubator-doris/issues?q=is%3Aissue) and 
found no similar issues.
   
   
   ### Version
   
   0.15
   
   ### What's Wrong?
   
   ```SQL
   # doris 0.15
   # timestampdiff between 1981-09-11 and 2022-04-28 should be 40 years
   SELECT 
     TIMESTAMPDIFF(YEAR,DATE('1981-09-11'),'2022-04-28') AS `date-str`,
        TIMESTAMPDIFF(YEAR,'1981-09-11','2022-04-28') AS `str-str`,
        TIMESTAMPDIFF(YEAR,DATE('1981-09-11'),DATE('2022-04-28')) AS 
`date-date`,
        TIMESTAMPDIFF(YEAR,'1981-09-11',DATE('2022-04-28')) AS `str-date`
   
   # while the result is 
   date-str     str-str         date-date               str-date
   41           40              41                      41
        
   # timestampdiff between 1981-04-11 and 2022-04-28 should be 41 years
   SELECT
     TIMESTAMPDIFF(YEAR,DATE('1981-09-11'),'2022-04-28') AS `date-str`,
        TIMESTAMPDIFF(YEAR,'1981-09-11','2022-04-28') AS `str-str`,
        TIMESTAMPDIFF(YEAR,DATE('1981-04-11'),DATE('2022-04-28')) AS 
`date-date`,
        TIMESTAMPDIFF(YEAR,'1981-04-11',DATE('2022-04-28')) AS `str-date`
   
   # while the result is 
   date-str     str-str         date-date               str-date
   41           40              41                      41
   
   
   ### What You Expected?
   
   timestampdiff between 1981-09-11 and 2022-04-28 should be 40 year
   timestampdiff between 1981-04-11 and 2022-04-28 should be 41 year
   
   This also happens when unit is MONTH or DAY.
   
   ### 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