开发者

printing to screen variables inside mapper

I want to check the contents of an element that is in my map functions, is there a way to print the contents of the variables to the screen. It is very slow to work on this stuff when I can't see what's in each of these variables. I have tried "System.out.println" but that doesn't seem to work inside the mapper.

public void map(Object key, Text value, Context context
               ) throws IOException, InterruptedException {

    String line = value.toString();
    System.out.println(line + "\n");
    String delimiter = "\t";
    String[] temp;

    temp =开发者_运维知识库 line.split(delimiter);

    for(int i =0; i < temp.length ; i++)
        System.out.println(temp[i]);

    StringTokenizer itr = new StringTokenizer(value.toString());
    while (itr.hasMoreTokens())
    {
        word.set(itr.nextToken().length() + "");
        context.write(word, one);
    }
}


Try running the job with the following format
$HADOOP_HOME/bin/hadoop -jar [your_jar_file]
The -jar forces it to be run as a local job and will output to the console.


Hadoop jobs are executed on remote servers, you can see STDOUT in jobtracker's web interface (see this question: How do I view standard out in hadoop? )

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜