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

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

                Author: ASF GitHub Bot
            Created on: 20/Aug/21 09:53
            Start Date: 20/Aug/21 09:53
    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_r692812560



##########
File path: ql/src/test/queries/clientpositive/udf_to_unix_timestamp.q
##########
@@ -18,8 +18,8 @@ SELECT
 FROM oneline_n0;
 
 SELECT
-  '2009 Mar 20 11:30:01 am',
-  to_unix_timestamp('2009 Mar 20 11:30:01 am', 'yyyy MMM dd h:mm:ss a')
+  '2009 Mar 20 11:30:01 AM',

Review comment:
       simpleDateFromat and DateTimeformatter both used 
locale(https://docs.oracle.com/javase/8/docs/api/java/util/Locale.html) to 
parse alphabet. By default system local in picked to in both the case. 
simpleDateFromat use Locale.getDefault(Locale.Category.FORMAT)) which is list 
of locale due to which it can parse "AM"/"am" not "aM" or "Am". Where as 
DateTimeformatter used only system default locale also DateTimeformatter by 
default in case Sensitive as well. If use either "AM"/"am" which is not in our 
control. I Do align the point the date value should be case insensitive but I 
couldn't able to find any DateTimeFromatter case insensitive  implementation 
with in hive code. But still in order to make unix_timestamp() backword 
compatible we need to make DateTimeformatter case insensitive.




-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

    Worklog Id:     (was: 640182)
    Time Spent: 1h 50m  (was: 1h 40m)

> unix_timestamp() with string input give wrong result
> ----------------------------------------------------
>
>                 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: 1h 50m
>  Remaining Estimate: 0h
>
> Description - 
> unix_timestamp() accept 4 value string/date/timestamp/timestamptz. Out of 
> which date/timestamp/timestamptz use DateTimeFormatter.class where as string 
> type use SimpleDateTimeformatter.class which cause difference is value.
> Example - 
> select from_unixtime(unix_timestamp('1800-11-08 01:53:11'));
> 1800-11-08 01:35:15
> select from_unixtime(unix_timestamp(cast('1800-11-08 01:53:11' as 
> timestamp)));
> 1800-11-08 01:53:11
>   



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

Reply via email to