user3607469
user3607469

Reputation: 53

In hadoop - Map-Reduce error with filesplit

When I use the below lines in map class:

String fileName = ((FileSplit) context.getInputSplit()).getPath().getName();
System.out.println(fileName);

I got an empty output file. Also, the last two lines in console are:

14/05/06 12:52:53 INFO mapred.JobClient:     Map output records=0
14/05/06 12:52:53 INFO mapred.JobClient:     SPLIT_RAW_BYTES=2127

Upvotes: 2

Views: 67

Answers (1)

Mouna
Mouna

Reputation: 3359

The problem is with the System.out.println(), you will not get the result in the console. You need to check your logs.

Or much easier: use a logger !

  1. Import classes needed for logging

    import org.apache.commons.logging.Log;
    import org.apache.commons.logging.LogFactory;
    
  2. Define the logger

    private static final Log LOG = LogFactory.getLog(MyClass.class);
    
  3. Log all what you need

    LOG.info(fileName);
    

You will get the results during the job execution in the console.

Upvotes: 1

Related Questions