[ 
https://issues.apache.org/jira/browse/HIVE-25458?focusedWorklogId=639381&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-639381
 ]

ASF GitHub Bot logged work on HIVE-25458:
-----------------------------------------

                Author: ASF GitHub Bot
            Created on: 18/Aug/21 16:50
            Start Date: 18/Aug/21 16:50
    Worklog Time Spent: 10m 
      Work Description: ashish-kumar-sharma commented on a change in pull 
request #2590:
URL: https://github.com/apache/hive/pull/2590#discussion_r690622040



##########
File path: ql/src/test/queries/clientpositive/udf5.q
##########
@@ -45,3 +45,10 @@ select from_unixtime(to_unix_timestamp(cast('0000-00-00' as 
date)));
 set time zone Europe/Rome;
 
 SELECT from_unixtime(1226446340), to_date(from_unixtime(1226446340)), 
day('2008-11-01'), month('2008-11-01'), year('2008-11-01'), day('2008-11-01 
15:32:20'), month('2008-11-01 15:32:20'), year('2008-11-01 15:32:20') FROM 
dest1_n14;
+
+set hive.local.time.zone=Asia/Bangkok;
+
+select from_unixtime(unix_timestamp('1400-11-08 01:53:11'));
+select from_unixtime(unix_timestamp('1800-11-08 01:53:11'));
+select from_unixtime(unix_timestamp('1400-11-08 08:00:00 ICT', 'yyyy-MM-dd 
HH:mm:ss z'));

Review comment:
       done

##########
File path: 
ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFToUnixTimeStamp.java
##########
@@ -164,15 +164,13 @@ public Object evaluate(DeferredObject[] arguments) throws 
HiveException {
           return null;
         }
         if (!patternVal.equals(lasPattern)) {
-          formatter.applyPattern(patternVal);
+          formatter = DateTimeFormatter.ofPattern(patternVal);
           lasPattern = patternVal;
         }
       }
-      try {
-        retValue.set(formatter.parse(textVal).getTime() / 1000);
-      } catch (ParseException e) {
-        return null;
-      }
+      Timestamp timestamp = new 
Timestamp(LocalDateTime.parse(textVal,formatter));

Review comment:
       done

##########
File path: 
ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFToUnixTimeStamp.java
##########
@@ -20,10 +20,14 @@
 
 import java.text.ParseException;
 import java.text.SimpleDateFormat;

Review comment:
       done




-- 
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: gitbox-unsubscr...@hive.apache.org

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


Issue Time Tracking
-------------------

    Worklog Id:     (was: 639381)
    Time Spent: 40m  (was: 0.5h)

> Make Date/Timestamp parser from LENIENT to STRICT in unix_timestamp()
> ---------------------------------------------------------------------
>
>                 Key: HIVE-25458
>                 URL: https://issues.apache.org/jira/browse/HIVE-25458
>             Project: Hive
>          Issue Type: Bug
>            Reporter: Ashish Sharma
>            Assignee: Ashish Sharma
>            Priority: Minor
>              Labels: pull-request-available
>          Time Spent: 40m
>  Remaining Estimate: 0h
>
> Description - 
> set hive.local.time.zone=Asia/Bangkok;
> select from_unixtime(unix_timestamp('1400-11-08 01:53:11'));
> Result - 1400-11-17 01:35:15
> Expected - 1400-11-08 01:53:11
> select from_unixtime(unix_timestamp('1800-11-08 01:53:11'));
> Result - 1800-11-08 01:35:15
> Expected - 1800-11-08 01:53:11
> select from_unixtime(unix_timestamp('1400-11-08 08:00:00 ICT', 'yyyy-MM-dd 
> HH:mm:ss z'));
> Result 1400-11-17 07:42:04
> Expected 1400-11-08 08:00:00 
> select from_unixtime(unix_timestamp('1800-11-08 08:00:00 ICT', 'yyyy-MM-dd 
> HH:mm:ss z'));
> Result - 1800-11-08 07:42:04
> Expected - 1800-11-08 08:00:00 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to