[ 
https://issues.apache.org/jira/browse/HIVE-1253?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Carl Steinbach updated HIVE-1253:
---------------------------------

    Affects Version/s:     (was: 0.6.0)
         Release Note:   (was: HIVE-1253. Fix Date_sub and Date_add in case of 
daylight saving. (Bryan Talbot via zshao))
              Summary: Fix Date_sub and Date_add in case of daylight saving  
(was: date_sub() function returns wrong date because of daylight saving time 
difference)

> Fix Date_sub and Date_add in case of daylight saving
> ----------------------------------------------------
>
>                 Key: HIVE-1253
>                 URL: https://issues.apache.org/jira/browse/HIVE-1253
>             Project: Hive
>          Issue Type: Bug
>          Components: Query Processor
>            Reporter: mingran wang
>            Assignee: Bryan Talbot
>             Fix For: 0.6.0
>
>         Attachments: HIVE-1253.patch
>
>
> date_sub('2010-03-15', 7) returns '2010-03-07'. This is because we have time 
> shifts on 2010-03-14 for daylight saving time.
> Looking at ql/src/java/org/apache/hadoop/hive/ql/udf/UDFDateSub.java, it is 
> getting a calendar instance in UTC time zone.
> def calendar = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
> And use calendar.add() to substract 7 days, then conver the time to 
> 'yyyy-MM-dd' format.
> If it simply uses default timezone, the problem is solved: "def calendar = 
> Calendar.getInstance());"
> When people use date_sub('2010-03-15', 7), I think they mean substract 7 
> days, instead of substracting 7*24 hours. So it should be an easy fix. The 
> same changes should go to date_add and date_diff

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to