You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by GitBox <gi...@apache.org> on 2022/04/28 09:42:32 UTC

[GitHub] [incubator-doris] alanredsheep opened a new issue, #9296: [Bug] TIMESTAMPDIFF(unit,datetime_expr1,datetime_expr2) get wrong result

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-unsubscribe@doris.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [incubator-doris] yiguolei closed issue #9296: [Bug] TIMESTAMPDIFF(unit,datetime_expr1,datetime_expr2) get wrong result

Posted by GitBox <gi...@apache.org>.
yiguolei closed issue #9296: [Bug] TIMESTAMPDIFF(unit,datetime_expr1,datetime_expr2) get wrong result
URL: https://github.com/apache/incubator-doris/issues/9296


-- 
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-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [incubator-doris] Toms1999 commented on issue #9296: [Bug] TIMESTAMPDIFF(unit,datetime_expr1,datetime_expr2) get wrong result

Posted by GitBox <gi...@apache.org>.
Toms1999 commented on issue #9296:
URL: https://github.com/apache/incubator-doris/issues/9296#issuecomment-1118273750

   sese


-- 
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-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org