You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@calcite.apache.org by "mihaibudiu (via GitHub)" <gi...@apache.org> on 2023/06/09 23:55:01 UTC

[GitHub] [calcite] mihaibudiu commented on a diff in pull request #3253: [CALCITE-5761] Handle DECADE, CENTURY, and MILLENNIUM for DATE_TRUNC

mihaibudiu commented on code in PR #3253:
URL: https://github.com/apache/calcite/pull/3253#discussion_r1224902085


##########
core/src/main/java/org/apache/calcite/adapter/enumerable/RexImpTable.java:
##########
@@ -2385,16 +2385,24 @@ private static class FloorImplementor extends MethodNameImplementor {
         case MONTH:
         case WEEK:
         case DAY:
+        case DECADE:
+        case CENTURY:
+        case MILLENNIUM:
           final Expression dayOperand0 =
               preFloor ? call(operand0, type, TimeUnit.DAY) : operand0;
           return Expressions.call(floorMethod,
               translator.getLiteral(operand1), dayOperand0);
         default:
+          if (call.op.getName().equals("DATE_TRUNC")) {

Review Comment:
   I haven't tested yet the behavior of TIMESTAMP functions.
   This is strictly addressing CALCITE-5761.
   It is possible that the timestamp functions have problems too.
   Are you suggesting to add SqlKind.DATE_TRUNC in this PR, or should I file an issue for that?



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

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