pig-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Daniel Dai (JIRA)" <j...@apache.org>
Subject [jira] [Resolved] (PIG-1151) Date Conversion + Arithmetic UDFs
Date Sat, 11 Oct 2014 07:39:34 GMT

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

Daniel Dai resolved PIG-1151.
-----------------------------
    Resolution: Won't Fix

These are covered in DateTime UDFs (https://pig.apache.org/docs/r0.11.1/func.html#datetime-functions).
Use ToDate + DateTime UDF should be a better alternative. Close the ticket.

> 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.14.0
>
>         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 was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message