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

Jonathan Coveney updated PIG-1151:
----------------------------------

        Fix Version/s: 0.12
    Affects Version/s:     (was: 0.10.0)
               Status: Open  (was: Patch Available)

I am un-patching this because it needs to be updated now that there is the 
DateTime type. Utility functions like this would definitely be useful, but they 
can now take advantage of the DateTime type in Pig. Feel free to ask if you 
want to know more.

Also, a note about contribution: in general, I prefer just a patch called 
PIG-<JIRA NUMBER>-<PATCH NUMBER>.patch. Compressing it isn't really necessary 
unless it's huuuuge, and makes it easier and faster to review.
                
> Date Conversion + Arithmetic UDFs
> ---------------------------------
>
>                 Key: PIG-1151
>                 URL: https://issues.apache.org/jira/browse/PIG-1151
>             Project: Pig
>          Issue Type: New Feature
>            Reporter: sam rash
>            Priority: Minor
>              Labels: patch
>             Fix For: 0.12
>
>         Attachments: patch_dateudf.tar.gz
>
>
> I would like to offer up some very simple data UDFs I have that wrap JodaTime 
> (apache 2.0 license, http://joda-time.sourceforge.net/license.html) and 
> operate on ISO8601 date strings.
> (for piggybank).  Please advise if these are appropriate.
> 1. Date Arithmetic
> takes an input string: 
> 2009-01-01T13:43:33.000Z
> (and partial ones such as 2009-01-02)
> and a timespan (as millis or as string shorthand)
> returns an ISO8601 string that adjusts the input date by the specified 
> timespan
> DatePlus(long timeMs); // + or - number works, is the # of millis
> DatePlus(String timespan); //10m = 10 minutes, 1h = 1 hour, 1172 ms, etc
> DateMinus(String timespan); //propose explicit minus when using string 
> shorthand for time periods
> 2. Date Comparison (when you don't have full strings that you can use string 
> compare with):
> DateIsBefore(String dateString); //true if lhs is before rhs
> DateIsAfter(String dateString); //true if lsh is after rhs
> 3. date trunc functions:
> takes partial ISO8601 strings and truncates to:
> toMinute(String dateString);
> toHour(String dateString);
> toDay(String dateString);
> toWeek(String dateString);
> toMonth(String dateString);
> toYear(String dateString);
> if any/all are helpful, I'm happy to contribute to pig

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to