Class: Spark::Command::SortByKey

Inherits:
Object
  • Object
show all
Defined in:
lib/spark/command/sort.rb

Overview


Sort

Instance Method Summary collapse

Instance Method Details

#before_runObject

Currently disabled



14
15
16
# File 'lib/spark/command/sort.rb', line 14

def before_run
  @spilling = false
end

#run(iterator, _) ⇒ Object



18
19
20
21
22
23
24
25
26
# File 'lib/spark/command/sort.rb', line 18

def run(iterator, _)
  if @spilling
    iterator = run_with_spilling(iterator.each)
  else
    run_without_spilling(iterator)
  end

  iterator
end

#run_with_enum(iterator, _) ⇒ Object



28
29
30
31
32
33
34
35
36
37
# File 'lib/spark/command/sort.rb', line 28

def run_with_enum(iterator, _)
  if @spilling
    iterator = run_with_spilling(iterator)
  else
    iterator = iterator.to_a
    run_without_spilling(iterator)
  end

  iterator
end