[ 
https://issues.apache.org/jira/browse/PIG-889?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12734119#action_12734119
 ] 

Jeff Zhang commented on PIG-889:
--------------------------------

Santhosh, Thank you for your review.
You are right, the testcase I provider will throw NullPointerException in local 
model.

After more investigation, I found that actually I can 
PigHadoopLogger.warn(Object o, String msg, Enum warningEnum) to increment 
Counter.
But it seems this method has some problems, because the Counter it generates is 
always one less than real Counter. And I found
this is because when Pig read the first record the reporter is null, but when 
it reads the second one, the reporter is not null. I guess the reason is that 
it is been set in PigMapBase (line 217) when do map operation on the first 
record.

I do some changes on my patch,  The load funct PigStorageUsingReporter I 
provide is not for local model, it is just to make sure in mapreduce mode, the 
reporter should not been null.



> Pig can not access reporter of PigHadoopLog in Load Func
> --------------------------------------------------------
>
>                 Key: PIG-889
>                 URL: https://issues.apache.org/jira/browse/PIG-889
>             Project: Pig
>          Issue Type: Improvement
>          Components: impl
>    Affects Versions: 0.4.0
>            Reporter: Jeff Zhang
>            Assignee: Jeff Zhang
>             Fix For: 0.4.0
>
>
> I'd like to increment Counter in my own LoadFunc, but it will throw 
> NullPointerException. It seems that the reporter is not initialized.  
> I looked into this problem and find that it need to call 
> PigHadoopLogger.getInstance().setReporter(reporter) in PigInputFormat.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to