2011-07-13 25 views
0

我目前正在使用MapReduce作業,我只使用沒有還原器的mapper。我不需要寫出密鑰,因爲我只需要存儲在數組中的值,並希望將其寫入爲最終輸出文件。 Hadoop如何實現這一點?我只想寫出唯一的值,而不是寫入輸出的鍵和值。這些值位於數組中。謝謝在Mapper作業中僅寫入值

public void pfor(TestFor pfor,LongWritable key, Text value, Context context, int times) throws IOException, InterruptedException{ 
    int n = 0; 
    while(n < times){ 
     pfor.pforMap(key,value, context); 
     n++; 
    } 
    for(int i =0;i<uv.length; i++){ 
     LOG.info(uv[i].get() + " Final output"); 
    } 
    IntArrayWritable edge = new IntArrayWritable(); 
    edge.set(uv); 
    context.write(new IntWritable(java.lang.Math.abs(randGen.nextInt())), edge);   
    uv= null; 
} 

回答