Hadoop Pig:传递命令行参数 [英] Hadoop Pig: Passing Command Line Arguments
本文介绍了Hadoop Pig:传递命令行参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有没有办法做到这一点?例如,传递要处理的文件的名称等?
Is there a way to do this? eg, pass the name of the file to be processed, etc?
推荐答案
这出现在 另一个问题,但您可以在命令行中指明输入参数并在加载时使用该参数,例如:
This showed up in another question, but you can indicate the input parameter on the command line and use that when you are loading, for example:
命令行:
pig -f script.pig -param input=somefile.txt
pig -f script.pig -param input=somefile.txt
script.pig:
script.pig:
raw = LOAD '$input' AS (...);
raw = LOAD '$input' AS (...);
请注意,如果您使用的是 Amazon Web Services Elastic Map Reduce,则$input"是传递给您提供的任何输入的脚本的内容.
Note that if you are using the Amazon Web Services Elastic Map Reduce then the '$input' is what is passed to the script for any input you provide.
这篇关于Hadoop Pig:传递命令行参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文