You are viewing a plain text version of this content. The canonical link for it is here.
Posted to gitbox@hive.apache.org by GitBox <gi...@apache.org> on 2021/05/24 09:29:00 UTC

[GitHub] [hive] pgaref commented on a change in pull request #2002: HIVE-24810: Use JDK 8 String Switch in TruncDateFromTimestamp

pgaref commented on a change in pull request #2002:
URL: https://github.com/apache/hive/pull/2002#discussion_r637813089



##########
File path: ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/TruncDateFromTimestamp.java
##########
@@ -147,18 +148,29 @@ protected void truncDate(ColumnVector inV, BytesColumnVector outV, int i) {
   }
 
   protected void processDate(BytesColumnVector outV, int i, Date date) {
-    if ("MONTH".equals(fmt) || "MON".equals(fmt) || "MM".equals(fmt)) {
+    switch (fmt) {
+    case "YEAR":
+    case "YYYY":
+    case "YY":
+      date.setMonth(1);

Review comment:
       date.setMonth(1) might be missing here?




-- 
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



---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org