Class: MapRedus::Counter
- Inherits:
-
Reducer
- Object
- QueueProcess
- Reducer
- MapRedus::Counter
- Defined in:
- lib/mapredus/default_classes.rb
Overview
Emits the length of the mapped value list.
The counter reducer tells how many values were emitted by the mapper. In situations where an adder could used but only has to sum up 1’s, counter will be much faster.
This works in MapRedus because all the values produced for one key is processed (reduced) by a single worker.
Constant Summary
Constants inherited from Reducer
Class Method Summary collapse
Methods inherited from Reducer
Methods inherited from QueueProcess
Class Method Details
.reduce(value_list) {|value_list.size| ... } ⇒ Object
67 68 69 |
# File 'lib/mapredus/default_classes.rb', line 67 def self.reduce(value_list) yield value_list.size end |
.reduce_perform(process, key) ⇒ Object
63 64 65 |
# File 'lib/mapredus/default_classes.rb', line 63 def self.reduce_perform(process, key) process.emit(key, FileSystem.llen(process.map_key(key))) end |