Module: RBPig

Defined in:
lib/rbpig.rb

Defined Under Namespace

Classes: Pig

Class Method Summary collapse

Class Method Details

.connect(configs) {|Pig.new(pig_configs(configs))| ... } ⇒ Object

Yields:

  • (Pig.new(pig_configs(configs)))


21
22
23
# File 'lib/rbpig.rb', line 21

def connect(configs)
  yield Pig.new(pig_configs(configs))
end

.executable(configs) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/rbpig.rb', line 6

def executable(configs)
  configs = pig_configs(configs)
  
  pig_options = ["-Dudf.import.list=forward.pig.storage"]
  unless configs[:hadoop_config].nil?
    hadoop_config = {}
    REXML::Document.new(File.new(configs[:hadoop_config])).elements.each('configuration/property') do |property|
      hadoop_config[property.elements[1].text] = property.elements[2].text
    end
    pig_options << "-Dfs.default.name=#{hadoop_config["fs.default.name"]}" if hadoop_config.has_key?("fs.default.name")
    pig_options << "-Dmapred.job.tracker=#{hadoop_config["mapred.job.tracker"]}" if hadoop_config.has_key?("mapred.job.tracker")
  end
  ["PIG_CLASSPATH='#{pig_classpath(configs)}'", "PIG_OPTS='#{pig_options.join(" ")}'", "pig", "-l /tmp"].join(" ")
end