Class: Swineherd::Script::PigScript
- Inherits:
-
Object
- Object
- Swineherd::Script::PigScript
- Includes:
- Common
- Defined in:
- lib/swineherd/script/pig_script.rb
Constant Summary collapse
- AVRO_PIG_MAPPING =
Not guaranteeing anything.
{ 'string' => 'chararray', 'int' => 'int', 'long' => 'long', 'float' => 'float', 'double' => 'double', 'bytes' => 'bytearray', 'fixed' => 'bytearray' }
Instance Attribute Summary
Attributes included from Common
#attributes, #input, #options, #output
Class Method Summary collapse
-
.avro_to_pig(avro_type) ⇒ Object
Simple utility function for mapping avro types to pig types.
Instance Method Summary collapse
- #cmd ⇒ Object
- #local_cmd ⇒ Object
-
#pig_args(options) ⇒ Object
Convert a generic hash of options => ‘bar’ into command line options for pig ‘-p FOO=bar’.
Methods included from Common
#env, #initialize, #refresh!, #run, #script
Class Method Details
.avro_to_pig(avro_type) ⇒ Object
Simple utility function for mapping avro types to pig types
21 22 23 |
# File 'lib/swineherd/script/pig_script.rb', line 21 def self.avro_to_pig avro_type AVRO_PIG_MAPPING[avro_type] end |
Instance Method Details
#cmd ⇒ Object
40 41 42 43 |
# File 'lib/swineherd/script/pig_script.rb', line 40 def cmd Log.info("Launching Pig script in hadoop mode") "pig #{pig_args(@options)} #{script}" end |
#local_cmd ⇒ Object
35 36 37 38 |
# File 'lib/swineherd/script/pig_script.rb', line 35 def local_cmd Log.info("Launching Pig script in local mode") "pig -x local #{pig_args(@options)} #{script}" end |
#pig_args(options) ⇒ Object
Convert a generic hash of options => ‘bar’ into command line options for pig ‘-p FOO=bar’
29 30 31 |
# File 'lib/swineherd/script/pig_script.rb', line 29 def pig_args .map{|opt,val| "-p #{opt.to_s.upcase}=#{val}" }.join(' ') end |