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



##########
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:
       @pgaref Thanks so much for taking a look.  I'm not sure however what 
your comment means.
   
   The year stuff get `Month=1` and `dayOfMonth=1`.  The Month stuff gets only 
`dayOfMonth=1`.
   
   This switch statement "falls through" to cover both outcomes.




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



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to