I've been thinking about the feedback at the contributors meeting Monday. I propose that we postpone the addition of a full datetime
PIG-1314 type in lieu of the builtins described below. This change is easy and I can do it immediately and get it in 0.8. The original proposal is quite hard, and I can't really estimate when I could have it completed. I'm not sure we need it. There are many other more important things I would rather do.
I'd like to remove the piggybank classes org.apache.pig.piggybank.evaluation.datetime.* or at least deprecate them.
I'd like to add the following builtins, which act on both ISO8601 datetime strings and long unix times. These could be made into many functions each, but I'd prefer to keep them as short as possible. I suggest we mirror the oracle date/time functions when possible: http://psoug.org/reference/date_func.html
When listed below, units are defined as one of:
TRUNC(date, unit) or TRUNC_DATE(date, unit)
long/epoch input returns long/epoch output.
ISO8601 string input returns IS08601 datetime output.
long/epoch input returns long output in the unit specified.
ISO8601 input returns an ISO8601 duration
- Adding/subtracting durations and dates: use longs.
The only ugly part to this is that ISO times are 2nd class citizens in that they cannot be added/subtracted. I'm prepared to live with that