You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pig.apache.org by "Dmitriy V. Ryaboy (JIRA)" <ji...@apache.org> on 2010/12/24 23:42:47 UTC

[jira] Commented: (PIG-1781) Piggybank: ISOToDay disregards timezone (should use ISODateTimeFormat instead of DateTime to parse)

    [ https://issues.apache.org/jira/browse/PIG-1781?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12974981#action_12974981 ] 

Dmitriy V. Ryaboy commented on PIG-1781:
----------------------------------------

Michael, 
Thanks a lot for contributing, I think this is a useful feature. 

We are not planning a 0.8.1 at the moment, but it's possible we will separate piggybank from Pig releases, so this would become available before 0.9.

Overall the patch looks good, but I think that you still want to set the default time zone to be UTC, not whatever the system default is. So you will want to put the DateTimeZone.setDefault(DateTimeZone.UTC) call into the new helper class.

Also, fyi, we generally generate patches, even for piggybank, from the top-level directory, the one that has contrib/ in it.

No need to apologize for not getting the patch submission process quite right, we are not above helping with that part, and would much rather someone submit a useful patch that's not quite formatted right, than not get the contribution :).

> Piggybank: ISOToDay disregards timezone (should use ISODateTimeFormat instead of DateTime to parse)
> ---------------------------------------------------------------------------------------------------
>
>                 Key: PIG-1781
>                 URL: https://issues.apache.org/jira/browse/PIG-1781
>             Project: Pig
>          Issue Type: Bug
>    Affects Versions: 0.8.0
>            Reporter: Michael Brauwerman
>         Attachments: PIG-1781.2.patch
>
>
> (Apologies if this is the wrong place to file Piggybank bugs)
> Bug in http://svn.apache.org/viewvc/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/datetime/truncate/ISOToDay.java?view=markup
> and other http://svn.apache.org/viewvc/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/datetime/truncate/ classes that copy-paste the same code.
> These classes parse dates like so:
>  	DateTimeZone.setDefault(DateTimeZone.UTC); 	
>  	DateTime dt = new DateTime((String)input.get(0).toString()); 
> This has two problems:
> (1) It messes up JVM static state by changing the DateTimeZone default time zone.
> (2) It ignore timezone information in the input string, so times like "2009-12-09T23:59:59-0800" get truncated to "2009-12-10T00:00:00Z", which is the wrong day of year. 
> Instead, they should use something like this, which respects the input timezone and does not modify any global state:
>   DateTime dt ISODateTimeFormat.dateTime().withOffsetParsed().parseDateTime(isoDateString);
> I have not provided a patch, because I'm not really set up to hack on Piggybank locally.
> As a workaround, I am copy-pasting the classes into my own packages, and making the desired change.

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