Is there anyway to ignore lines that end with ":" in MapReduce in Java?

Viewed 37

We have been given this csv dataset, that has a few rows that end with ":", we are supposed to ignore those lines and move on to the next line to perform MapReduce using Java.

Example Input :

1.1

1,2.3

2,3.4

2.2

1,4.5

3,6.6

2,3.0

How should I proceed? I've already tried this :

public void mapperOne (Object key, Text value, Context context)
        throws IOException, InterruptedException {
        Scanner s = new Scanner(value.toString()).useDelimiter(",");
        if (!(s.next().contains(":"))) {
             int x = s.nextInt();
             double y = s.nextDouble();
             context.write(new IntWritable(x),new DoubleWritable(y));
        } 
        s.close();
    }


  
0 Answers
Related