我想在亚马逊的Elastic Map Reduce上运行我的Pig脚本(它使用UDF)。 我需要在我的UDF中使用一些静态文件。在猪弹性地图上使用分布式缓存Reduce
我做这样的事情在我的UDF:
public class MyUDF extends EvalFunc<DataBag> {
public DataBag exec(Tuple input) {
...
FileReader fr = new FileReader("./myfile.txt");
...
}
public List<String> getCacheFiles() {
List<String> list = new ArrayList<String>(1);
list.add("s3://path/to/myfile.txt#myfile.txt");
return list;
}
}
我已经存储在文件中我的S3存储桶/path/to/myfile.txt
但是,在运行我的猪的工作,我在Amazon EMR猪运行脚本时如何使用分布式缓存文件:看一个例外:
Got an exception java.io.FileNotFoundException: ./myfile.txt (No such file or directory)
所以,我的问题是什么吗?
编辑:我想出了猪-0.6,不像pig-0.9没有称为getCacheFiles()的函数。亚马逊不支持猪-0.6,所以我需要找出一种不同的方式来获得分布式缓存工作在0.6
也许你已经知道了,但对于其他人,亚马逊现在支持Pig 0.6和0.9.1 http://aws.amazon.com/elasticmapreduce/faqs/#pig-7 –