[ https://issues.apache.org/jira/browse/PIG-1781?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Michael Brauwerman updated PIG-1781: ------------------------------------ Attachment: PIG-1781.2.patch Updated patch, created at trunk/contrib/piggybank. 'ant test' ran to BUILD SUCCESSFUL New Changes in this patch: * Re-indented all touched files to use 4-spaces instead of tabs. * Removed some stray System.out.println lines in some tests * Changed some assertTrue(foo.equals(bar)) to assertEquals(foo, bar) (for clearer output when tests fail.) Changes between repo and this patch, that I forgot to mention earlier: * Changed some assertTrue(foo.equals(bar)) to assertEquals(foo, bar) (for clearer output when tests fail.) Concerns: * piggybank does not have a 'doc' or 'test-patch' target, so I could not run those. Particularly, I couldn't run the "hudson auto-review" locally. * I'm not 100% on the interaction between core pig and piggybank in the build files, so I hope I did not break or overlook anything in that interaction. I got Eclipse set up to develop on Pig, which is much nicer than Xcode. Yay. OK, I hope this is helpful! It would be swell if this change got merged the 0.8 branch also (if an 0.8.1 release is planned), but I'm in no personal rush, since I have a local build that works for my project. Oh, and if this behavior change is undesired for some reason, no hard feelings. I don't know if anyone else is using Piggybank for bucketing-by-day analysis in non-UTC timezones, but I am, and so the truncate package is quite handy for me; I just need a version that works on US/Pacific-timezone dateTimes. > 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, PIG-1781.patch, svn.diff > > > (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.