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:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]