我正在寫一個Hadoop應用程序在一定的分辨率計算地圖數據。我的輸入文件是根據QuadTile原則命名的地圖。我需要對這些樣本進行二次抽樣,然後將這些樣本拼接在一起,直到我擁有一個覆蓋面積較大但分辨率較低的較高層次的拼貼。就像縮小在谷歌地圖。迭代Map和Reduce操作
目前我的Mapper子樣本瓷磚和我的縮減器將瓷磚組合成一定的層次並形成一層的瓷磚。所以這麼好。但根據我需要的瓦片,我需要重複這些地圖並將步驟縮短x倍,這是迄今爲止我無法做到的。
這樣做的最佳方式是什麼?是否有可能沒有明確地保存瓷磚在臨時目錄中,並開始一個新的地圖減少這些臨時目錄,直到我得到我想要的?我認爲完美的解決方案大致類似於'while(context.hasMoreThanOneKey()){iterate mapreduce}'。
經過一個答案,我現在已經寫了延伸工作類TileJob。但是,mapreduc仍然沒有鏈接。你能告訴我我做錯了什麼嗎?
public boolean waitForCompletion(boolean verbose) throws IOException, InterruptedException, ClassNotFoundException{
if(desiredkeylength != currentinputkeylength-1){
System.out.println("In loop, setting input at " + tempout);
String tempin = tempout;
FileInputFormat.setInputPaths(this, tempin);
tempout = (output + currentinputkeylength + "/");
FileOutputFormat.setOutputPath(this, new Path(tempout));
System.out.println("Setting output at " + tempout);
currentinputkeylength--;
Configuration conf = new Configuration();
TileJob job = new TileJob(conf);
job.setJobName(getJobName());
job.setUpJob(tempin, tempout, tiletogenerate, currentinputkeylength);
return job.waitForCompletion(verbose);
}else{
//desiredkeylength == currentkeylength-1
System.out.println("In else, setting input at " + tempout);
String tempin = tempout;
FileInputFormat.setInputPaths(this, tempin);
tempout = output;
FileOutputFormat.setOutputPath(this, new Path(tempout));
System.out.println("Setting output at " + tempout);
currentinputkeylength--;
Configuration conf = new Configuration();
TileJob job = new TileJob(conf);
job.setJobName(getJobName());
job.setUpJob(tempin, tempout, tiletogenerate, currentinputkeylength);
currentinputkeylength--;
return super.waitForCompletion(verbose);
}
}
我改變了我的問題與我目前的問題。你能澄清我做錯了什麼嗎? – KarelV
查看更新的答案 –
非常感謝,那是做的工作。 – KarelV