[
https://issues.apache.org/jira/browse/HIVE-1253?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Zheng Shao updated HIVE-1253:
-----------------------------
Resolution: Fixed
Fix Version/s: 0.6.0
Release Note: HIVE-1253. Fix Date_sub and Date_add in case of daylight
saving. (Bryan Talbot via zshao) (was: Fix off-by-one issue with date_sub and
date_add when date ranges include a daylight savings time change.)
Status: Resolved (was: Patch Available)
Committed. Thanks Bryan!
> date_sub() function returns wrong date because of daylight saving time
> difference
> ---------------------------------------------------------------------------------
>
> Key: HIVE-1253
> URL: https://issues.apache.org/jira/browse/HIVE-1253
> Project: Hadoop Hive
> Issue Type: Bug
> Components: Query Processor
> Affects Versions: 0.6.0
> 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.