Class: HadoopDsl::LogAnalysis::LogAnalysisReducer

Inherits:
BaseReducer show all
Defined in:
lib/log_analysis.rb

Instance Attribute Summary

Attributes inherited from BaseMapRed

#emitted

Instance Method Summary collapse

Methods inherited from BaseReducer

#aggregate, #identity

Methods inherited from BaseMapRed

#emit

Methods included from DslController

#pre_process, #run

Methods included from DslElement

#method_missing

Constructor Details

#initialize(script, key, values) ⇒ LogAnalysisReducer

Returns a new instance of LogAnalysisReducer.



103
104
105
# File 'lib/log_analysis.rb', line 103

def initialize(script, key, values)
  super(script, LogAnalysisReducerModel.new(key, values))
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class HadoopDsl::DslElement

Instance Method Details

#count_uniq(column) ⇒ Object



116
117
118
# File 'lib/log_analysis.rb', line 116

def count_uniq(column)
  aggregate if @model.topic == @model.current_topic
end

#sum(column) ⇒ Object



120
121
122
# File 'lib/log_analysis.rb', line 120

def sum(column)
  aggregate if @model.topic == @model.current_topic
end

#topic(desc, options = {}, &block) ⇒ Object



110
111
112
113
114
# File 'lib/log_analysis.rb', line 110

def topic(desc, options = {}, &block)
  @model.create_topic(desc, options)
  yield if block_given?
  @model.current_topic
end