hadoop-hive-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bryan Talbot (JIRA)" <j...@apache.org>
Subject [jira] Updated: (HIVE-1253) date_sub() function returns wrong date because of daylight saving time difference
Date Sat, 20 Mar 2010 00:13:27 GMT

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

Bryan Talbot updated HIVE-1253:

    Attachment: HIVE-1253.patch

Patch includes new JUnit tests for UDFDateSub, UDFDateAdd and UDFDateDiff to test correctness
over daylight savings time changes.

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

View raw message