Class: UniqueReduce

Inherits:
ReduceBase show all
Defined in:
lib/mrtoolkit.rb

Overview

Reducer collects unique values Outputs as many lines as there are unique values in the first field.

Instance Attribute Summary

Attributes inherited from Stage

#errors, #in_fields, #in_sep, #out_fields, #out_sep

Instance Method Summary collapse

Methods inherited from ReduceBase

#process, #process_begin, #process_each, #process_end, #process_end_internal, #process_init, #process_internal, #run

Methods inherited from Stage

#catch_errors, #copy_struct, #emit, #emit_separator, #field, #field_separator, #initialize, #new_input, #new_output, #prepare, #process_step, #write_out

Constructor Details

This class inherits a constructor from Stage

Instance Method Details

#declareObject



326
327
328
329
330
# File 'lib/mrtoolkit.rb', line 326

def declare
  field :value

  emit :value
end

#process_term(input, output) ⇒ Object



332
333
334
335
# File 'lib/mrtoolkit.rb', line 332

def process_term(input, output)
  output.value = @last
  output
end