Class: Spark::Command::CombineByKey::CombineWithZero
- Defined in:
- lib/spark/command/pair.rb
Overview
Constant Summary
Constants inherited from Base
Base::DEFAULT_VARIABLE_OPTIONS
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
Methods inherited from Base
Methods inherited from Base
#before_run, error, #error, #execute, init_settings, #initialize, #log, #method_missing, #prepare, #prepared?, #settings, settings, #to_s, variable
Constructor Details
This class inherits a constructor from Spark::Command::Base
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Spark::Command::Base
Instance Method Details
#_run(iterator) ⇒ Object
65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/spark/command/pair.rb', line 65 def _run(iterator) # Not use combiners[key] ||= .. # it tests nil and not has_key? combiners = {} iterator.each do |key, value| unless combiners.has_key?(key) combiners[key] = @zero_value end combiners[key] = @merge_value.call(combiners[key], value) end combiners end |