vendredi 22 janvier 2016

hadoop mapreduce programming if condition

I have wrote the below code, which is not comparing if block keep on going into else block....please go through that and check if you found any discrepancy.

plz help on that

public static class ReduceIncurance extends Reducer

{
    //private static  HashMap<String, String> InsuranceData = new HashMap<String, String>();
    //private Text txtMapOutputKey = new Text("");
    //private IntWritable txtMapOutputValue;

    public void reduce(Text key, Iterable<Text> values , Context context) throws IOException, InterruptedException

    {

        int sum =0;
        int count=0;
        String[] input = values.toString().split(",");

        for (String val : input)
        {
            System.out.println("first:"+val);   
        if (val.equalsIgnoreCase("Residential"))
          {
            System.out.println(val);
               /*String line = val.toString();
               String[] elements = line.split(",");*/
          count ++;
          sum += count;
          }
        else
        {
            System.out.println("into elsee part");
            count ++;
            sum += count;
        }

        context.write(key, new IntWritable(sum));
        }



    }

}

Aucun commentaire:

Enregistrer un commentaire