You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@doris.apache.org by GitBox <gi...@apache.org> on 2019/05/28 03:30:30 UTC
[GitHub] [incubator-doris] imay commented on a change in pull request #1208:
Fix datediff function
imay commented on a change in pull request #1208: Fix datediff function
URL: https://github.com/apache/incubator-doris/pull/1208#discussion_r287918807
##########
File path: fe/src/main/java/org/apache/doris/rewrite/FEFunctions.java
##########
@@ -55,9 +55,16 @@
@FEFunction(name = "datediff", argTypes = { "DATETIME", "DATETIME" }, returnType = "INT")
public static IntLiteral dateDiff(LiteralExpr first, LiteralExpr second) throws AnalysisException {
- long diff = getTime(first) - getTime(second);
- long datediff = diff / 1000 / 60 / 60 / 24;
- return new IntLiteral(datediff, Type.INT);
+ String[] parsePatterns = { "yyyyMMdd" };
+ try {
+ //DATEDIFF function only uses the date part for calculations and ignores the time part
Review comment:
```suggestion
// DATEDIFF function only uses the date part for calculations and ignores the time part
```
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@doris.apache.org
For additional commands, e-mail: dev-help@doris.apache.org