Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Plain View
Pig >> mail # user >> UDF Counters

Daan Gerits 2011-11-09, 19:45
Copy link to this message
Re: UDF Counters
On Wed, Nov 9, 2011 at 2:45 PM, Daan Gerits <[EMAIL PROTECTED]> wrote:
> Hello everyone,
> Is it possible to update a counter from within an UDF? I know there is some information on updating counters using log messages, but I have never done that before and have no idea if it is working with pig.

This seems to work for me:

                       PigStatusReporter reporter PigStatusReporter.getInstance();
if (reporter != null) {
  reporter.getCounter("name", "group").increment(1);

Also see http://squarecog.wordpress.com/2010/12/24/incrementing-hadoop-counters-in-apache-pig/