[
https://issues.apache.org/jira/browse/PIG-3014?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13494789#comment-13494789
]
Cheolsoo Park commented on PIG-3014:
------------------------------------
Hi Jonathan,
I agree with using the job start time. That sounds reasonable to me.
But I have two comments regarding your patch:
- The Apache license header shouldn't be removed in
{{src/org/apache/pig/builtin/CurrentTime.java}}.
- After applying your patch, {{src/org/apache/pig/builtin/CurrentTime.java}}
looks like this. Can you please fix indentations?
{code}
/**
* This is a default constructor for Pig reflection purposes. It should
* never actually be used.
*/
public CurrentTime() {}
@Override
public DateTime exec(Tuple input) throws IOException {
if (!isInitialized) {
String dateTimeValue =
UDFContext.getUDFContext().getJobConf().get("pig.job.submitted.timestamp");
if (dateTimeValue == null) {
throw new ExecException("pig.job.submitted.timestamp was not
set!");
}
dateTime = new DateTime(Long.parseLong(dateTimeValue));
isInitialized = true;
}
return dateTime;
}
{code}
Thanks!
> CurrentTime() UDF has undesirable characteristics
> -------------------------------------------------
>
> Key: PIG-3014
> URL: https://issues.apache.org/jira/browse/PIG-3014
> Project: Pig
> Issue Type: Bug
> Reporter: Jonathan Coveney
> Assignee: Jonathan Coveney
> Fix For: 0.12
>
> Attachments: PIG-3014-0.patch, PIG-3014-1.patch
>
>
> As part of the explanation of the new DateTime datatype I noticed that we had
> added a CurrentTime() UDF. The issue with this UDF is that it returns the
> current time _of every exec invocation_, which can lead to confusing results.
> In PIG-1431 I proposed a way such that every instance of the same NOW() will
> return the same time, which I think is better. Would enjoy thoughts.
--
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