You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pig.apache.org by "Russell Jurney (JIRA)" <ji...@apache.org> on 2010/07/02 08:17:49 UTC
[jira] Commented: (PIG-1430) ISODateTime -> DateTime: DateTime UDFs
Should Also Support int/second Unix Times in All Operations
[ https://issues.apache.org/jira/browse/PIG-1430?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12884557#action_12884557 ]
Russell Jurney commented on PIG-1430:
-------------------------------------
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
* Units
When listed below, units are defined as one of:
YEAR
MONTH
WEEK
DAY
HOUR
MINUTE
SECOND
* Truncations
TRUNC(date, unit) or TRUNC_DATE(date, unit)
long/epoch input returns long/epoch output.
ISO8601 string input returns IS08601 datetime output.
* Dates to durations
DURATION(date, unit)
long/epoch input returns long output in the unit specified.
ISO8601 input returns an ISO8601 duration
* Adding/subtracting durations and dates: use longs.
* Utilities
CURRENT_ISOTIME
CURRENT_UNIXTIME
ISOTOUNIX
UNIXTOISO
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 :)
> ISODateTime -> DateTime: DateTime UDFs Should Also Support int/second Unix Times in All Operations
> --------------------------------------------------------------------------------------------------
>
> Key: PIG-1430
> URL: https://issues.apache.org/jira/browse/PIG-1430
> Project: Pig
> Issue Type: Improvement
> Components: impl
> Affects Versions: 0.7.0
> Reporter: Russell Jurney
> Fix For: 0.8.0
>
>
> All functions in contrib.piggybank.java.src.main.java.org.apache.pig.piggybank.evaluation.datetime should seamlessly accept integer Unix/POSIX times, and return Unix time output when given an int, and ISO output when given a chararray.
> Note: Unix/POSIX times are the number of seconds elapsed since midnight proleptic Coordinated Universal Time (UTC) of January 1, 1970, not counting leap seconds. See http://en.wikipedia.org/wiki/Unix_time
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.