[ Skip to the content ]

Institute of Formal and Applied Linguistics Wiki


[ Back to the navigation ]

This is an old revision of the document!


MapReduce Tutorial : Counters

Sometimes it is useful to count events differently than outputting them (key, value) pairs. For that reason Hadoop offers simple counter framework.

sub map {
  my ($self, $key, $value, $context) = @_;
 
  $context->counter($group, $name, $increment);
}

Exercise

Run a MR job on /home/straka/wiki/cs-text, which uses counters to count the number of articles according to their first letter (ignoring the case and possible diacritics).

Solution.pl


[ Back to the navigation ] [ Back to the content ]