Class: HadoopDsl::HiveLike::HiveLikeMapper
- Inherits:
-
BaseMapper
- Object
- BaseMapRed
- BaseMapper
- HadoopDsl::HiveLike::HiveLikeMapper
- Includes:
- HiveLikeMapRed
- Defined in:
- lib/hive_like.rb
Instance Attribute Summary
Attributes inherited from BaseMapRed
Instance Method Summary collapse
-
#initialize(script, key, value) ⇒ HiveLikeMapper
constructor
A new instance of HiveLikeMapper.
-
#select(*args) ⇒ Object
emitters.
Methods included from HiveLikeMapRed
#pre_process, #sprit_and_marge_args
Methods inherited from BaseMapper
Methods inherited from BaseMapRed
Methods included from DslController
Methods included from DslElement
Constructor Details
#initialize(script, key, value) ⇒ HiveLikeMapper
Returns a new instance of HiveLikeMapper.
48 49 50 |
# File 'lib/hive_like.rb', line 48 def initialize(script, key, value) super(script, HiveLikeMapperModel.new(key, value)) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class HadoopDsl::DslElement
Instance Method Details
#select(*args) ⇒ Object
emitters
57 58 59 60 61 62 63 64 65 66 |
# File 'lib/hive_like.rb', line 57 def select(*args) from_index = args.index('from') if from_index values = args[0...from_index].map do |column| splitted = @model.value.split(/[,\s]+/) splitted[@model.table.columns.index(column)] end emit(args[from_index + 1] => values.join(", ")) end end |