empty output file when converting from String to IntWritable

i set the input file as a CSV file once i try to convert from String to IntWritable i get an empty output directory

import org.apache.hadoop.io.IntWritable; import org.apache.hadoop.io.Text; import org.apache.hadoop.mapreduce.Mapper;  import java.io.IOException; import java.util.StringTokenizer;  public class MapperClass         extends Mapper<Object, Text, Text, IntWritable>{      private IntWritable unitSold= new IntWritable();     private Text itemType = new Text();     private String[] data;      public void map(Object key, Text value, Mapper.Context context     ) throws IOException, InterruptedException , NumberFormatException {         StringTokenizer itr = new StringTokenizer(value.toString(),"\n");                  while (itr.hasMoreTokens()) {             data=itr.nextToken().split(",");             itemType.set(data[2]);              unitSold.set(Integer.parseInt(data[8].toString())); // the line that cause the problem after its added              if (data[3].contains("Offline"))                 context.write(itemType,unitSold);         }     } } 
Add Comment
0 Answer(s)

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.