gianm commented on a change in pull request #9337: Fix timestamp extract fn to
match postgreSQL
URL: https://github.com/apache/druid/pull/9337#discussion_r377945477
##########
File path:
processing/src/main/java/org/apache/druid/query/expression/TimestampExtractExprMacro.java
##########
@@ -141,13 +141,13 @@ public ExprEval eval(final ObjectBinding bindings)
return ExprEval.of(dateTime.year().get());
case DECADE:
// The year field divided by 10, See
https://www.postgresql.org/docs/10/functions-datetime.html
- return ExprEval.of(Math.floor(dateTime.year().get() / 10));
+ return ExprEval.of(dateTime.year().get() / 10);
case CENTURY:
- return ExprEval.of(dateTime.centuryOfEra().get() + 1);
+ return ExprEval.of(Math.ceil((double) dateTime.year().get() /
100));
case MILLENNIUM:
// Years in the 1900s are in the second millennium. The third
millennium started January 1, 2001.
// See https://www.postgresql.org/docs/10/functions-datetime.html
- return ExprEval.of(Math.round(Math.ceil(dateTime.year().get() /
1000)));
+ return ExprEval.of(Math.round(Math.ceil((double)
dateTime.year().get() / 1000)));
Review comment:
Could it be suppressed in that one location?
----------------------------------------------------------------
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]