我想在亞馬遜的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 –