Class: Spark::Command::CombineByKey::Merge

Inherits:
Base
  • Object
show all
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

#__objects__

Instance Method Summary collapse

Methods inherited from Base

#lazy_run, #run

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



46
47
48
49
50
51
52
53
54
55
56
# File 'lib/spark/command/pair.rb', line 46

def _run(iterator, *)
  combiners = {}
  iterator.each do |key, value|
    if combiners.has_key?(key)
      combiners[key] = @merge_combiners.call(combiners[key], value)
    else
      combiners[key] = value
    end
  end
  combiners
end