2015-05-20 44 views
0

當我試圖調用與屬性文件豬腳本,然後我得到錯誤:錯誤傳遞參數通過豬腳本時得到

pig -P /mapr/ANALYTICS/apps/PigTest/pig.properties -f pig_if_condition.pig 
SLF4J: Class path contains multiple SLF4J bindings. 
SLF4J: Found binding in [jar:file:/opt/mapr/lib/slf4j-log4j12-1.7.5.jar!/org/slf4j/impl/StaticLoggerBinder.class] 
SLF4J: Found binding in [jar:file:/opt/mapr/hbase/hbase-0.98.4/lib/slf4j-log4j12-1.6.4.jar!/org/slf4j/impl/StaticLoggerBinder.class] 
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation. 
SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory] 
15/05/20 15:42:52 ERROR pig.Main: ERROR 2999: Unexpected internal error. Unable to parse properties file 

'/mapr/ANALYTICS/apps/PigTest/pig.properties' 15/05/20 15:42:52 WARN pig.Main: There is no log file to write to. 15/05/20 15:42:52 ERROR pig.Main: java.lang.RuntimeException: Unable to parse properties file '/mapr/ANALYTICS/apps/PigTest/pig.properties' at org.apache.pig.Main.run(Main.java:343) at org.apache.pig.Main.main(Main.java:156) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.apache.hadoop.util.RunJar.main(RunJar.java:212)

豬腳本是:

test = load '$path' USING PigStorage(',') AS (ip:chararray,country:chararray); 
DUMP test; 
+1

請編輯您的帖子添加的屬性文件的內容,請。 – Balduz

回答

0

-param(-p)是指定一個參數。要指定參數文件,我們必須使用-param_file屬性。

捷徑指令:

  1. -m相同-param_file
  2. -p相同-param

用法:

pig -param_file {property_file} -f {pig_file} 

例如:

pig -param_file a.properties -f a.pig 

豬腳本:a.pig

A = LOAD '$INPUT' USING PigStorage(',') AS (country_code:chararray, country_name:chararray); 
DUMP A; 

屬性文件:a.properties

INPUT=a.csv 

測試文件:a.csv

IN,India 
US,United States 
UK,United Kingdom 

輸出:

(IN,India) 
(US,United States) 
(UK,United Kingdom)