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/