Class: Spark::Command::PartitionBy::Sorting

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

#__objects__

Instance Method Summary collapse

Methods inherited from Base

#lazy_run, #run

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

#prepareObject



181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
# File 'lib/spark/command/basic.rb', line 181

def prepare
  super

  # Index by bisect alghoritm
  @partition_func ||= Proc.new do |key|
    count = 0
    @bounds.each{|i|
      break if i >= key
      count += 1
    }

    if @ascending
      count
    else
      @num_partitions - 1 - count
    end
  end
end