title: skipping the header from java map reduce code
body: <p>I am trying to get the summary of a csv file and the first line of the file is the header. Is there a way to make the values of each column with its header name as key value pair from the Java code.</p>
  
  <p>Eg: Input file is like </p>
  
  <p>A,B,C,D</p>
  
  <p>1,2,3,4</p>
  
  <p>5,6,7,8</p>
  
  <p>I want the the output from mapper as <code>(A,1),(B,2),(C,3),(D,4),(A,5),....</code></p>
  
  <p>Note:I tried using overriding the run function in the Mapper class to skip the first line. But As far as I know the run function gets called for each input split and is thus not suiting my need. Any help on this will really be appreciated.</p>
  
  <p>This is the way my mapper looks:</p>
  
  <pre><code>public void map(LongWritable key, Text value, Context context) throws IOException, InterruptedException {
  
          String line = value.toString();
          String[] splits = line.split(",",-1);
          int length = splits.length;
      //  count = 0;
  
          for (int i = 0; i &lt; length; i++) {
              columnName.set(header[i]);      
              context.write(columnName, new Text(splits[i]+""));
          }
  
      }
  
      public void run(Context context) throws IOException, InterruptedException
      {        
          setup(context); 
          try 
          {
  
              if (context.nextKeyValue())
              { 
  
                  Text columnHeader = context.getCurrentValue();
                  header =  columnHeader.toString().split(",");
  
              }    
              while (context.nextKeyValue()) 
              {
                  map(context.getCurrentKey(), context.getCurrentValue(), context);
              }
          } 
          finally 
          {
              cleanup(context);
          }      
      }
  </code></pre>