如何将csv文件读入map中的二维数组reduce

时间:2017-12-29 06:23:28

标签: java mapreduce

public class samReducer extends Reducer<Text, callingFunction, Text, Text> {
    protected void reduce(Text key, Iterable<callingFunction> values, Context context)
            throws IOException, InterruptedException {
        // TODO Auto-generated method stub
        Iterator<callingFunction> iterator = values.iterator();
        String toPass = "";
        int i = 0;
        String tmp[] = new String[300];
        //String temp = "";
        while(iterator.hasNext())
        {
             /*toPass = iterator.next().toString()+ " ";
            context.write(key , new Text((toPass)));*/
            tmp[i++] = iterator.next().toString();
            //i++;
        }
        for(i=0; i<300; i++)
            context.write(key, new Text(tmp[i]));
    }
}

我想在map reduce中将它用于反向传播算法。

0 个答案:

没有答案
相关问题