你好,我正在尝试运行猪脚本与参数。
cat unbz2.pig
a = load '$source' using PigStorage();
store a into '$target' using PigStorage();
然后在CMD中运行以下命令:
$ pig -f /home/user/unbz2.pig –param source=/part-m-* -param target=/unzip2
2014-08-22 11:51:33,015 [main] INFO org.apache.pig.Main - Apache Pig version 0.11.0-cdh4.6.0 (rexported) compiled Feb 26 2014, 03:01:22
2014-08-22 11:51:33,016 [main] INFO org.apache.pig.Main - Logging error messages to: /home/user/pig_1408722693009.log
2014-08-22 11:51:34,041 [main] INFO org.apache.pig.impl.util.Utils - Default bootup file /home/user/.pigbootup not found
2014-08-22 11:51:34,151 [main] ERROR org.apache.pig.Main - ERROR 2999: Unexpected internal error. Undefined parameter : source
Details at logfile: /home/user/pig_1408722693009.log
我不知道我做错了什么。请帮助。 您只需要在执行pig脚本之前传递参数,因为现在您在执行pig命令之后传递参数。您可以像-
一样传递参数pig -param parameter=<parameter value> /home/user/unbz2.pig
你可以删除$,只输入参数'source'
a = load 'source' using PigStorage();
store a into 'target' using PigStorage();