Method: Spark::Command::CombineByKey::Combine#_run
- Defined in:
- lib/spark/command/pair.rb
#_run(iterator) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/spark/command/pair.rb', line 26 def _run(iterator) # Not use combiners[key] ||= .. # it tests nil and not has_key? combiners = {} iterator.each do |key, value| if combiners.has_key?(key) combiners[key] = @merge_value.call(combiners[key], value) else combiners[key] = @create_combiner.call(value) end end combiners end |