class Spark::Command::PartitionBy::Sorting

Public Instance Methods

prepare() click to toggle source
# 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