1

I am writing an application in java using hadoop framework that should give me 3 columns month defined as Size, item defined as iteam_size, and total values. I am implementing my own writable class named My code but its giving me different output please can anyone tell me whats going wrong? here is my code:-

Mycode(Custom Writable)

package com.some.writable;

import java.io.DataInput;

import java.io.DataOutput;

import java.io.IOException;

import org.apache.hadoop.io.Text;

import org.apache.hadoop.io.WritableComparable;

public class Mycode implements WritableComparable<Mycode> {

    Text first;
    Text second;

    public Mycode(Text first, Text second) {
        set(first, second);
    }

    public Mycode() {
        set(new Text(), new Text());
    }

    public Mycode(String first, String second) {
        set(new Text(first), new Text(second));
    }

    public Text getFirst() {
        return first;
    }

    public Text getSecond() {
        return second;
    }

    public void set(Text first, Text second) {
        this.first = first;
        this.second = second;
    }

    @Override
    public void readFields(DataInput in) throws IOException {
        first.readFields(in);
        second.readFields(in);
    }

    @Override
    public void write(DataOutput out) throws IOException {
        first.write(out);
        second.write(out);
    }
    @Override
    public int compareTo(Mycode tp) {
        int cmp = first.compareTo(tp.first);

        if (cmp != 0) {
            return cmp;
        }

        return second.compareTo(tp.second);
    }

    @Override
    public int hashCode(){
        return first.hashCode() + second.hashCode();
    }

    @Override
    public boolean equals(Object o)
    {
        if(o instanceof Mycode)
        {
            Mycode tp = (Mycode) o;
            return first.equals(tp.first) && second.equals(tp.second);
        }
        return false;
    }

}

mywritablemapper.java(mapper class)

package com.some.writable;

import java.io.IOException;

import java.util.StringTokenizer;

import org.apache.hadoop.io.IntWritable;

import org.apache.hadoop.io.LongWritable;

import org.apache.hadoop.io.Text;

import org.apache.hadoop.mapreduce.Mapper;

public class mywritablemapper extends
     Mapper<LongWritable, Text, Mycode, IntWritable>{ 
    static int i=-1;
    static int j=-1;
    Mycode n=new Mycode();
@Override
   public void map(LongWritable key, Text value, Context context)
           throws IOException, InterruptedException, NumberFormatException {
    String[] iteam= {"NIVEA","CHICKEN","BURGER","JEANS","SHIRT","T-SHIRT","BOOKS","JACKETS","SHOES","MOBILES","PEPSI","PEN"};
    String[] months = {"JAN", "FEB", "MAR","APR","MAY","JUN","JUL","AUG","SEP","OCT","NOV","DEC"};
    String iteam_size= iteam[j+1];
    String size= months[i+1];
    String line = value.toString();
    StringTokenizer st=new StringTokenizer(line," ");
    String agg = new String();
    while(st.hasMoreTokens())
       {
           agg=st.nextToken();
           IntWritable a = new IntWritable(Integer.parseInt(agg));
           Text z= new Text(size);
           Text x =new Text(iteam_size);
           n.set(z,x);
           context.write(n,a);
           System.out.println(n+" "+a);
           }
    j++;
    i++;
}
}

Reducer class:-

package com.some.writable;
import java.io.IOException;

import java.util.StringTokenizer;

import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;
import org.apache.hadoop.mapreduce.Reducer;
public class mywritablereducer extends Reducer<Mycode, IntWritable, Text, IntWritable>{ 
     Text ab = new Text();
    public void reduce(Mycode key, Iterable<IntWritable> values, Context context)
             throws IOException, InterruptedException {

        int count=0;
        for(IntWritable value: values)
        {
            count += value.get();
        }

        ab.set(key.toString());
        context.write(ab, new IntWritable(count));
        System.out.println(ab+""+count);
     }

}

driverclass

package com.some.writable;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;
import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;
import org.apache.hadoop.util.GenericOptionsParser;
//import com.some.iteams.Iteamreducer;
import com.some.writable.mywritablemapper;
import com.some.writable.mywritablereducer;
public class mywritabledriver {
   public static void main(String[] args) throws Exception {
      Configuration conf = new Configuration();
      String[] programArgs =
          new GenericOptionsParser(conf, args).getRemainingArgs();
      /*if (programArgs.length != 2) {
         System.err.println("Usage: MaxTemp <in> <out>");
         System.exit(2);
      }*/
      Job job = new Job(conf, "MycodeWritable");
      job.setJarByClass(mywritabledriver.class);
      job.setMapperClass(mywritablemapper.class);
      job.setReducerClass(mywritablereducer.class);
      job.setMapOutputKeyClass(Mycode.class);
      job.setMapOutputValueClass(IntWritable.class);
      job.setOutputKeyClass(Text.class);
      job.setOutputValueClass(IntWritable.class);
      FileInputFormat.addInputPath(job, new Path("/home/biadmin/Record.txt"));
      FileOutputFormat.setOutputPath(job, new Path("/home/biadmin/dead"));
      System.exit(job.waitForCompletion(true) ? 0 : 1);
   }
 }

Output (output should be like month column, item column, then total values)

16/12/25 04:04:31 INFO Configuration.deprecation: mapred.job.name is deprecated. Instead, use mapreduce.job.name
16/12/25 04:04:31 INFO Configuration.deprecation: mapred.mapoutput.key.class is deprecated. Instead, use mapreduce.map.output.key.class
16/12/25 04:04:31 INFO Configuration.deprecation: mapred.mapoutput.value.class is deprecated. Instead, use mapreduce.map.output.value.class
16/12/25 04:04:31 INFO Configuration.deprecation: mapred.output.key.class is deprecated. Instead, use mapreduce.job.output.key.class
16/12/25 04:04:31 INFO Configuration.deprecation: mapred.output.value.class is deprecated. Instead, use mapreduce.job.output.value.class
16/12/25 04:04:31 INFO Configuration.deprecation: mapred.input.dir is deprecated. Instead, use mapreduce.input.fileinputformat.inputdir
16/12/25 04:04:31 INFO Configuration.deprecation: mapred.output.dir is deprecated. Instead, use mapreduce.output.fileoutputformat.outputdir
16/12/25 04:04:31 INFO Configuration.deprecation: mapred.reduce.tasks is deprecated. Instead, use mapreduce.job.reduces
16/12/25 04:04:31 INFO Configuration.deprecation: mapred.job.tracker is deprecated. Instead, use mapreduce.jobtracker.address
16/12/25 04:04:31 INFO Configuration.deprecation: mapred.map.tasks is deprecated. Instead, use mapreduce.job.maps
16/12/25 04:04:31 INFO Configuration.deprecation: session.id is deprecated. Instead, use dfs.metrics.session-id
16/12/25 04:04:31 INFO Configuration.deprecation: mapred.job.queue.name is deprecated. Instead, use mapreduce.job.queuename
16/12/25 04:04:31 INFO Configuration.deprecation: mapred.submit.replication is deprecated. Instead, use mapreduce.client.submit.file.replication
16/12/25 04:04:31 INFO Configuration.deprecation: mapred.used.genericoptionsparser is deprecated. Instead, use mapreduce.client.genericoptionsparser.used
16/12/25 04:04:31 INFO Configuration.deprecation: mapred.cache.archives is deprecated. Instead, use mapreduce.job.cache.archives
16/12/25 04:04:31 INFO Configuration.deprecation: mapred.cache.files is deprecated. Instead, use mapreduce.job.cache.files
16/12/25 04:04:31 INFO Configuration.deprecation: mapred.jar is deprecated. Instead, use mapreduce.job.jar
16/12/25 04:04:31 WARN mapred.JobClient: No job jar file set.  User classes may not be found. See JobConf(Class) or JobConf#setJar(String).
16/12/25 04:04:31 INFO Configuration.deprecation: mapred.working.dir is deprecated. Instead, use mapreduce.job.working.dir
16/12/25 04:04:31 INFO Configuration.deprecation: mapred.reduce.tasks is deprecated. Instead, use mapreduce.job.reduces
16/12/25 04:04:31 INFO Configuration.deprecation: mapred.min.split.size is deprecated. Instead, use mapreduce.input.fileinputformat.split.minsize
16/12/25 04:04:31 INFO Configuration.deprecation: mapred.max.split.size is deprecated. Instead, use mapreduce.input.fileinputformat.split.maxsize
16/12/25 04:04:31 INFO Configuration.deprecation: mapred.input.pathFilter.class is deprecated. Instead, use mapreduce.input.pathFilter.class
16/12/25 04:04:31 INFO input.FileInputFormat: Total input paths to process : 1
16/12/25 04:04:31 INFO Configuration.deprecation: mapred.map.tasks is deprecated. Instead, use mapreduce.job.maps
16/12/25 04:04:31 INFO Configuration.deprecation: mapred.job.queue.name is deprecated. Instead, use mapreduce.job.queuename
16/12/25 04:04:31 INFO Configuration.deprecation: mapreduce.map.class is deprecated. Instead, use mapreduce.job.map.class
16/12/25 04:04:31 INFO Configuration.deprecation: mapreduce.reduce.class is deprecated. Instead, use mapreduce.job.reduce.class
16/12/25 04:04:31 INFO Configuration.deprecation: mapred.local.dir is deprecated. Instead, use mapreduce.cluster.local.dir
16/12/25 04:04:31 INFO Configuration.deprecation: local.cache.size is deprecated. Instead, use mapreduce.tasktracker.cache.local.size
16/12/25 04:04:31 INFO Configuration.deprecation: mapred.cache.files.timestamps is deprecated. Instead, use mapreduce.job.cache.files.timestamps
16/12/25 04:04:31 INFO Configuration.deprecation: mapred.job.classpath.files is deprecated. Instead, use mapreduce.job.classpath.files
16/12/25 04:04:31 INFO Configuration.deprecation: mapred.cache.archives.timestamps is deprecated. Instead, use mapreduce.job.cache.archives.timestamps
16/12/25 04:04:31 INFO Configuration.deprecation: mapred.job.classpath.archives is deprecated. Instead, use mapreduce.job.classpath.archives
16/12/25 04:04:31 INFO Configuration.deprecation: mapred.cache.localFiles is deprecated. Instead, use mapreduce.job.cache.local.files
16/12/25 04:04:31 INFO Configuration.deprecation: mapred.cache.localArchives is deprecated. Instead, use mapreduce.job.cache.local.archives
16/12/25 04:04:31 WARN mapred.LocalJobRunner: LocalJobRunner does not support symlinking into current working dir.
16/12/25 04:04:31 INFO Configuration.deprecation: mapred.child.tmp is deprecated. Instead, use mapreduce.task.tmp.dir
16/12/25 04:04:31 INFO Configuration.deprecation: mapred.map.tasks is deprecated. Instead, use mapreduce.job.maps
16/12/25 04:04:31 INFO Configuration.deprecation: user.name is deprecated. Instead, use mapreduce.job.user.name
16/12/25 04:04:31 INFO Configuration.deprecation: mapred.job.name is deprecated. Instead, use mapreduce.job.name
16/12/25 04:04:31 INFO Configuration.deprecation: jobclient.output.filter is deprecated. Instead, use mapreduce.client.output.filter
16/12/25 04:04:31 INFO mapred.JobClient: Running job: job_local_0001
16/12/25 04:04:31 INFO Configuration.deprecation: mapred.task.profile is deprecated. Instead, use mapreduce.task.profile
16/12/25 04:04:31 INFO Configuration.deprecation: mapred.task.profile.maps is deprecated. Instead, use mapreduce.task.profile.maps
16/12/25 04:04:31 INFO Configuration.deprecation: mapred.task.profile.reduces is deprecated. Instead, use mapreduce.task.profile.reduces
16/12/25 04:04:31 INFO mapred.LocalJobRunner: OutputCommitter set in config null
16/12/25 04:04:31 INFO Configuration.deprecation: mapred.output.dir is deprecated. Instead, use mapreduce.output.fileoutputformat.outputdir
16/12/25 04:04:31 INFO mapred.LocalJobRunner: OutputCommitter is org.apache.hadoop.mapreduce.lib.output.FileOutputCommitter
16/12/25 04:04:31 INFO Configuration.deprecation: mapred.reduce.tasks is deprecated. Instead, use mapreduce.job.reduces
16/12/25 04:04:31 INFO Counters.deprecation: Group org.apache.hadoop.mapred.Task$Counter is deprecated. Use org.apache.hadoop.mapreduce.TaskCounter instead
16/12/25 04:04:31 INFO Configuration.deprecation: mapred.local.dir is deprecated. Instead, use mapreduce.cluster.local.dir
16/12/25 04:04:31 INFO Configuration.deprecation: mapred.tip.id is deprecated. Instead, use mapreduce.task.id
16/12/25 04:04:31 INFO Configuration.deprecation: mapred.task.id is deprecated. Instead, use mapreduce.task.attempt.id
16/12/25 04:04:31 INFO Configuration.deprecation: mapred.task.is.map is deprecated. Instead, use mapreduce.task.ismap
16/12/25 04:04:31 INFO Configuration.deprecation: mapred.task.partition is deprecated. Instead, use mapreduce.task.partition
16/12/25 04:04:31 INFO Configuration.deprecation: mapred.job.id is deprecated. Instead, use mapreduce.job.id
16/12/25 04:04:31 INFO Configuration.deprecation: hadoop.net.static.resolutions is deprecated. Instead, use mapreduce.tasktracker.net.static.resolutions
16/12/25 04:04:32 INFO Configuration.deprecation: mapred.working.dir is deprecated. Instead, use mapreduce.job.working.dir
16/12/25 04:04:32 INFO Configuration.deprecation: mapred.work.output.dir is deprecated. Instead, use mapreduce.task.output.dir
16/12/25 04:04:32 INFO util.ProcessTree: setsid exited with exit code 0
16/12/25 04:04:32 INFO mapred.Task:  Using ResourceCalculatorPlugin : org.apache.hadoop.util.LinuxResourceCalculatorPlugin@d935de01
16/12/25 04:04:32 INFO Configuration.deprecation: mapred.skip.on is deprecated. Instead, use mapreduce.job.skiprecords
16/12/25 04:04:32 INFO Configuration.deprecation: io.sort.spill.percent is deprecated. Instead, use mapreduce.map.sort.spill.percent
16/12/25 04:04:32 INFO Configuration.deprecation: io.sort.mb is deprecated. Instead, use mapreduce.task.io.sort.mb
16/12/25 04:04:32 INFO mapred.MapTask: io.sort.mb = 100
16/12/25 04:04:32 INFO mapred.MapTask: data buffer = 79691776/99614720
16/12/25 04:04:32 INFO mapred.MapTask: record buffer = 262144/327680
16/12/25 04:04:32 INFO Configuration.deprecation: mapred.output.key.comparator.class is deprecated. Instead, use mapreduce.job.output.key.comparator.class
16/12/25 04:04:32 INFO Configuration.deprecation: mapred.mapoutput.key.class is deprecated. Instead, use mapreduce.map.output.key.class
16/12/25 04:04:32 INFO Configuration.deprecation: mapred.mapoutput.value.class is deprecated. Instead, use mapreduce.map.output.value.class
16/12/25 04:04:32 INFO Configuration.deprecation: mapred.compress.map.output is deprecated. Instead, use mapreduce.map.output.compress
16/12/25 04:04:32 INFO Configuration.deprecation: min.num.spills.for.combine is deprecated. Instead, use mapreduce.map.combine.minspills
16/12/25 04:04:32 INFO Configuration.deprecation: mapred.linerecordreader.maxlength is deprecated. Instead, use mapreduce.input.linerecordreader.line.maxlength
com.some.writable.Mycode@6240ecc 92
com.some.writable.Mycode@6240ecc 34
com.some.writable.Mycode@6240ecc 100
com.some.writable.Mycode@6240ecc 100
com.some.writable.Mycode@6240ecc 11
com.some.writable.Mycode@6240ecc 399
com.some.writable.Mycode@6240ecc 200
com.some.writable.Mycode@6240ecc 100
com.some.writable.Mycode@6240ecc 23
com.some.writable.Mycode@6240ecc 45
com.some.writable.Mycode@6240ecc 12
com.some.writable.Mycode@6240ecc 89
com.some.writable.Mycode@6240ecc 200
com.some.writable.Mycode@6240ecc 100
com.some.writable.Mycode@bf256a36 200
com.some.writable.Mycode@bf256a36 293
com.some.writable.Mycode@bf256a36 12
com.some.writable.Mycode@bf256a36 200
com.some.writable.Mycode@bf256a36 214
com.some.writable.Mycode@bf256a36 34
com.some.writable.Mycode@bf256a36 45
com.some.writable.Mycode@bf256a36 12
com.some.writable.Mycode@bf256a36 65
com.some.writable.Mycode@bf256a36 29
com.some.writable.Mycode@bf256a36 11
com.some.writable.Mycode@bf256a36 53
com.some.writable.Mycode@bf256a36 39
com.some.writable.Mycode@bf256a36 50
com.some.writable.Mycode@aa5bd953 11
com.some.writable.Mycode@aa5bd953 39
com.some.writable.Mycode@aa5bd953 65
com.some.writable.Mycode@aa5bd953 54
com.some.writable.Mycode@aa5bd953 53
com.some.writable.Mycode@aa5bd953 400
com.some.writable.Mycode@aa5bd953 200
com.some.writable.Mycode@aa5bd953 300
com.some.writable.Mycode@aa5bd953 14
com.some.writable.Mycode@aa5bd953 33
com.some.writable.Mycode@aa5bd953 34
com.some.writable.Mycode@aa5bd953 11
com.some.writable.Mycode@aa5bd953 89
com.some.writable.Mycode@aa5bd953 100
com.some.writable.Mycode@5e971ac 14
com.some.writable.Mycode@5e971ac 15
com.some.writable.Mycode@5e971ac 83
com.some.writable.Mycode@5e971ac 11
com.some.writable.Mycode@5e971ac 512
com.some.writable.Mycode@5e971ac 499
com.some.writable.Mycode@5e971ac 200
com.some.writable.Mycode@5e971ac 100
com.some.writable.Mycode@5e971ac 32
com.some.writable.Mycode@5e971ac 65
com.some.writable.Mycode@5e971ac 48
com.some.writable.Mycode@5e971ac 22
com.some.writable.Mycode@5e971ac 100
com.some.writable.Mycode@5e971ac 240
com.some.writable.Mycode@669ec19 45
com.some.writable.Mycode@669ec19 32
com.some.writable.Mycode@669ec19 12
com.some.writable.Mycode@669ec19 25
com.some.writable.Mycode@669ec19 21
com.some.writable.Mycode@669ec19 65
com.some.writable.Mycode@669ec19 300
com.some.writable.Mycode@669ec19 200
com.some.writable.Mycode@669ec19 100
com.some.writable.Mycode@669ec19 65
com.some.writable.Mycode@669ec19 89
com.some.writable.Mycode@669ec19 200
com.some.writable.Mycode@669ec19 189
com.some.writable.Mycode@669ec19 0
com.some.writable.Mycode@14ebbcbe 51
com.some.writable.Mycode@14ebbcbe 23
com.some.writable.Mycode@14ebbcbe 65
com.some.writable.Mycode@14ebbcbe 98
com.some.writable.Mycode@14ebbcbe 0
com.some.writable.Mycode@14ebbcbe 24
com.some.writable.Mycode@14ebbcbe 45
com.some.writable.Mycode@14ebbcbe 12
com.some.writable.Mycode@14ebbcbe 599
com.some.writable.Mycode@14ebbcbe 52
com.some.writable.Mycode@14ebbcbe 13
com.some.writable.Mycode@14ebbcbe 53
com.some.writable.Mycode@14ebbcbe 92
com.some.writable.Mycode@14ebbcbe 1
com.some.writable.Mycode@57d97e9 143
com.some.writable.Mycode@57d97e9 41
com.some.writable.Mycode@57d97e9 244
com.some.writable.Mycode@57d97e9 43
com.some.writable.Mycode@57d97e9 50
com.some.writable.Mycode@57d97e9 25
com.some.writable.Mycode@57d97e9 100
com.some.writable.Mycode@57d97e9 56
com.some.writable.Mycode@57d97e9 192
com.some.writable.Mycode@57d97e9 52
com.some.writable.Mycode@57d97e9 22
com.some.writable.Mycode@57d97e9 100
com.some.writable.Mycode@57d97e9 41
com.some.writable.Mycode@57d97e9 41
com.some.writable.Mycode@252e0d16 53
com.some.writable.Mycode@252e0d16 55
com.some.writable.Mycode@252e0d16 100
com.some.writable.Mycode@252e0d16 41
com.some.writable.Mycode@252e0d16 21
com.some.writable.Mycode@252e0d16 289
com.some.writable.Mycode@252e0d16 33
com.some.writable.Mycode@252e0d16 15
com.some.writable.Mycode@252e0d16 35
com.some.writable.Mycode@252e0d16 395
com.some.writable.Mycode@252e0d16 11
com.some.writable.Mycode@252e0d16 400
com.some.writable.Mycode@252e0d16 0
com.some.writable.Mycode@252e0d16 14
com.some.writable.Mycode@66a1804 100
com.some.writable.Mycode@66a1804 433
com.some.writable.Mycode@66a1804 200
com.some.writable.Mycode@66a1804 100
com.some.writable.Mycode@66a1804 100
com.some.writable.Mycode@66a1804 100
com.some.writable.Mycode@66a1804 32
com.some.writable.Mycode@66a1804 22
com.some.writable.Mycode@66a1804 0
com.some.writable.Mycode@66a1804 22
com.some.writable.Mycode@66a1804 22
com.some.writable.Mycode@66a1804 11
com.some.writable.Mycode@66a1804 104
com.some.writable.Mycode@66a1804 45
com.some.writable.Mycode@dbb5e22f 11
com.some.writable.Mycode@dbb5e22f 51
com.some.writable.Mycode@dbb5e22f 22
com.some.writable.Mycode@dbb5e22f 150
com.some.writable.Mycode@dbb5e22f 31
com.some.writable.Mycode@dbb5e22f 15
com.some.writable.Mycode@dbb5e22f 24
com.some.writable.Mycode@dbb5e22f 500
com.some.writable.Mycode@dbb5e22f 200
com.some.writable.Mycode@dbb5e22f 53
com.some.writable.Mycode@dbb5e22f 192
com.some.writable.Mycode@dbb5e22f 67
com.some.writable.Mycode@dbb5e22f 240
com.some.writable.Mycode@dbb5e22f 0
com.some.writable.Mycode@63e6844 100
com.some.writable.Mycode@63e6844 0
com.some.writable.Mycode@63e6844 150
com.some.writable.Mycode@63e6844 29
com.some.writable.Mycode@63e6844 40
com.some.writable.Mycode@63e6844 70
com.some.writable.Mycode@63e6844 0
com.some.writable.Mycode@63e6844 0
com.some.writable.Mycode@63e6844 50
com.some.writable.Mycode@63e6844 200
com.some.writable.Mycode@63e6844 0
com.some.writable.Mycode@63e6844 0
com.some.writable.Mycode@63e6844 0
com.some.writable.Mycode@63e6844 205
com.some.writable.Mycode@32599 0
com.some.writable.Mycode@32599 100
com.some.writable.Mycode@32599 200
com.some.writable.Mycode@32599 300
com.some.writable.Mycode@32599 0
com.some.writable.Mycode@32599 323
com.some.writable.Mycode@32599 50
com.some.writable.Mycode@32599 0
com.some.writable.Mycode@32599 50
com.some.writable.Mycode@32599 200
com.some.writable.Mycode@32599 100
com.some.writable.Mycode@32599 0
com.some.writable.Mycode@32599 100
com.some.writable.Mycode@32599 23
16/12/25 04:04:32 INFO mapred.MapTask: Starting flush of map output
16/12/25 04:04:32 INFO mapred.MapTask: Finished spill 0
16/12/25 04:04:32 INFO mapred.Task: Task:attempt_local_0001_m_000000_0 is done. And is in the process of commiting
16/12/25 04:04:32 INFO Counters.deprecation: Group FileSystemCounters is deprecated. Use org.apache.hadoop.mapreduce.FileSystemCounter instead
16/12/25 04:04:32 INFO mapred.LocalJobRunner: 
16/12/25 04:04:32 INFO mapred.Task: Task 'attempt_local_0001_m_000000_0' done.
16/12/25 04:04:32 INFO Counters.deprecation: Group org.apache.hadoop.mapred.Task$Counter is deprecated. Use org.apache.hadoop.mapreduce.TaskCounter instead
16/12/25 04:04:32 INFO Configuration.deprecation: mapred.map.tasks is deprecated. Instead, use mapreduce.job.maps
16/12/25 04:04:32 INFO mapred.Task:  Using ResourceCalculatorPlugin : org.apache.hadoop.util.LinuxResourceCalculatorPlugin@77c604f7
16/12/25 04:04:32 INFO Configuration.deprecation: mapred.job.tracker is deprecated. Instead, use mapreduce.jobtracker.address
16/12/25 04:04:32 INFO mapred.LocalJobRunner: 
16/12/25 04:04:32 INFO Configuration.deprecation: keep.failed.task.files is deprecated. Instead, use mapreduce.task.files.preserve.failedtasks
16/12/25 04:04:32 INFO Configuration.deprecation: io.sort.factor is deprecated. Instead, use mapreduce.task.io.sort.factor
16/12/25 04:04:32 INFO mapred.Merger: Merging 1 sorted segments
16/12/25 04:04:32 INFO mapred.Merger: Down to the last merge-pass, with 1 segments left of total size: 2788 bytes
16/12/25 04:04:32 INFO mapred.LocalJobRunner: 
16/12/25 04:04:32 INFO Configuration.deprecation: mapred.output.value.groupfn.class is deprecated. Instead, use mapreduce.job.output.group.comparator.class
16/12/25 04:04:32 INFO Configuration.deprecation: mapred.output.compress is deprecated. Instead, use mapreduce.output.fileoutputformat.compress
16/12/25 04:04:32 INFO Configuration.deprecation: mapred.textoutputformat.separator is deprecated. Instead, use mapreduce.output.textoutputformat.separator
com.some.writable.Mycode@5e971ac1941
com.some.writable.Mycode@252e0d161462
com.some.writable.Mycode@325991446
com.some.writable.Mycode@bf256a361257
com.some.writable.Mycode@6240ecc1505
com.some.writable.Mycode@57d97e91150
com.some.writable.Mycode@14ebbcbe1128
com.some.writable.Mycode@aa5bd9531403
com.some.writable.Mycode@669ec191343
com.some.writable.Mycode@63e6844844
com.some.writable.Mycode@dbb5e22f1556
com.some.writable.Mycode@66a18041291
16/12/25 04:04:32 INFO mapred.Task: Task:attempt_local_0001_r_000000_0 is done. And is in the process of commiting
16/12/25 04:04:32 INFO Counters.deprecation: Group FileSystemCounters is deprecated. Use org.apache.hadoop.mapreduce.FileSystemCounter instead
16/12/25 04:04:32 INFO mapred.LocalJobRunner: 
16/12/25 04:04:32 INFO mapred.Task: Task attempt_local_0001_r_000000_0 is allowed to commit now
16/12/25 04:04:32 INFO output.FileOutputCommitter: Saved output of task 'attempt_local_0001_r_000000_0' to file:/home/biadmin/dead
16/12/25 04:04:32 INFO mapred.LocalJobRunner: reduce > reduce
16/12/25 04:04:32 INFO mapred.Task: Task 'attempt_local_0001_r_000000_0' done.
16/12/25 04:04:32 INFO Configuration.deprecation: job.end.notification.url is deprecated. Instead, use mapreduce.job.end-notification.url
16/12/25 04:04:32 INFO mapred.JobClient:  map 100% reduce 100%
16/12/25 04:04:32 INFO mapred.JobClient: Job complete: job_local_0001
16/12/25 04:04:32 INFO mapred.JobClient: Counters: 20
16/12/25 04:04:32 INFO mapred.JobClient:   File System Counters
16/12/25 04:04:32 INFO mapred.JobClient:     FILE: BYTES_READ=4452
16/12/25 04:04:32 INFO mapred.JobClient:     FILE: BYTES_WRITTEN=198006
16/12/25 04:04:32 INFO mapred.JobClient:   org.apache.hadoop.mapreduce.TaskCounter
16/12/25 04:04:32 INFO mapred.JobClient:     MAP_INPUT_RECORDS=12
16/12/25 04:04:32 INFO mapred.JobClient:     MAP_OUTPUT_RECORDS=168
16/12/25 04:04:32 INFO mapred.JobClient:     MAP_OUTPUT_BYTES=2450
16/12/25 04:04:32 INFO mapred.JobClient:     MAP_OUTPUT_MATERIALIZED_BYTES=2792
16/12/25 04:04:32 INFO mapred.JobClient:     SPLIT_RAW_BYTES=94
16/12/25 04:04:32 INFO mapred.JobClient:     COMBINE_INPUT_RECORDS=0
16/12/25 04:04:32 INFO mapred.JobClient:     COMBINE_OUTPUT_RECORDS=0
16/12/25 04:04:32 INFO mapred.JobClient:     REDUCE_INPUT_GROUPS=12
16/12/25 04:04:32 INFO mapred.JobClient:     REDUCE_SHUFFLE_BYTES=0
16/12/25 04:04:32 INFO mapred.JobClient:     REDUCE_INPUT_RECORDS=168
16/12/25 04:04:32 INFO mapred.JobClient:     REDUCE_OUTPUT_RECORDS=12
16/12/25 04:04:32 INFO mapred.JobClient:     SPILLED_RECORDS=336
16/12/25 04:04:32 INFO mapred.JobClient:     CPU_MILLISECONDS=0
16/12/25 04:04:32 INFO mapred.JobClient:     PHYSICAL_MEMORY_BYTES=0
16/12/25 04:04:32 INFO mapred.JobClient:     VIRTUAL_MEMORY_BYTES=0
16/12/25 04:04:32 INFO mapred.JobClient:     COMMITTED_HEAP_BYTES=299237376
16/12/25 04:04:32 INFO mapred.JobClient:   File Input Format Counters 
16/12/25 04:04:32 INFO mapred.JobClient:     Bytes Read=680
16/12/25 04:04:32 INFO mapred.JobClient:   org.apache.hadoop.mapreduce.lib.output.FileOutputFormat$Counter
16/12/25 04:04:32 INFO mapred.JobClient:     BYTES_WRITTEN=470

I dont know where I am doing mistake please look to it

1 Answer 1

2

You did not provide toString method in your class, that's why you see

com.some.writable.Mycode@63e6844 205

instead of

NIVEA JAN 205

example:

@Override
public String toString() {
     return first.toString() + " " + second.toString();
}

also some notes:

  1. hashCode is wrong. use at least 31 * first.hashCode() + second.hashCode();
  2. move array declarations from map method to class fields
Sign up to request clarification or add additional context in comments.

4 Comments

can you give me some more information on hash code I mean some tutorial or some sort I want to learn more about them so that I can write efficiently thank you.
@Anmol you can check this question stackoverflow.com/questions/113511/…
sorry I forgot I jus did it, thank you for quick response.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.