Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Next revision Both sides next revision | ||
courses:mapreduce-tutorial:step-4 [2012/01/24 21:28] straka |
courses:mapreduce-tutorial:step-4 [2012/01/24 21:33] straka |
||
---|---|---|---|
Line 3: | Line 3: | ||
Sometimes it is useful to count events differently than outputting them (key, value) pairs. For that reason Hadoop offers simple counter framework. | Sometimes it is useful to count events differently than outputting them (key, value) pairs. For that reason Hadoop offers simple counter framework. | ||
- | <code perl> | + | Hadoop maintains a collection of pre-defined and user-defined counters. Every counter is identified by its group name and counter name. To increment a counter, the following code can be used: |
- | ... | + | |
- | sub map() { | + | |
+ | <code perl> | ||
+ | sub map { | ||
+ | my ($self, $key, $value, $context) = @_; | ||
+ | |||
+ | $context-> | ||
} | } | ||
- | ... | ||
</ | </ | ||
+ | |||
+ | At the end of computation, | ||
===== Exercise ===== | ===== Exercise ===== |