Class: Spark::Command::PartitionBy::Base
- Includes:
- Helper::Serialize
- Defined in:
- lib/spark/command/basic.rb
Constant Summary
Constants included from Helper::Serialize
Helper::Serialize::DIRECTIVE_CHARS, Helper::Serialize::DIRECTIVE_DOUBLES_BIG_ENDIAN, Helper::Serialize::DIRECTIVE_DOUBLE_BIG_ENDIAN, Helper::Serialize::DIRECTIVE_INTEGERS_BIG_ENDIAN, Helper::Serialize::DIRECTIVE_INTEGER_BIG_ENDIAN, Helper::Serialize::DIRECTIVE_LONGS_BIG_ENDIAN, Helper::Serialize::DIRECTIVE_LONG_BIG_ENDIAN, Helper::Serialize::DIRECTIVE_UNSIGNED_CHARS
Constants inherited from Base
Base::DEFAULT_VARIABLE_OPTIONS
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
Methods included from Helper::Serialize
#pack_double, #pack_doubles, #pack_int, #pack_ints, #pack_long, #pack_longs, #pack_unsigned_chars, #unpack_chars, #unpack_int, #unpack_long
Methods inherited from Base
#before_run, error, #error, #execute, init_settings, #initialize, #log, #method_missing, #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
#lazy_run(iterator) ⇒ Object
155 156 157 158 159 |
# File 'lib/spark/command/basic.rb', line 155 def lazy_run(iterator, *) iterator.flat_map do |item| make_partition_item(item) end end |
#prepare ⇒ Object
140 141 142 143 144 145 |
# File 'lib/spark/command/basic.rb', line 140 def prepare super # Default. Keep it after super because Sorting has own key_function. @key_function ||= lambda{|x| x[0]} end |
#run(iterator) ⇒ Object
147 148 149 150 151 152 153 |
# File 'lib/spark/command/basic.rb', line 147 def run(iterator, *) iterator.map! do |item| make_partition_item(item) end iterator.flatten!(1) iterator end |