Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Threaded View
MapReduce, mail # user - Modified file gives me the same old output.


Copy link to this message
-
Modified file gives me the same old output.
Sitaraman Vilayannur 2013-12-28, 13:39
Hi,
  Following HAdoop in action, i changed the IntSumReducer like the
below, but my output continues to show the original output including
the 1s and the 2s....I verified with jad that the classfile has the
said modification.... What could i be missing...
Sitaraman

[sitaraman@localhost hadoopplayground]$
/usr/local/Software/hadoop-2.2.0/bin/hadoop fs -cat
/user/sitaraman/output/*
Java HotSpot(TM) 64-Bit Server VM warning: You have loaded library
/usr/local/Software/hadoop-2.2.0/lib/native/libhadoop.so.1.0.0 which
might have disabled stack guard. The VM will try to fix the stack
guard now.
It's highly recommended that you fix the library with 'execstack -c
<libfile>', or link it with '-z noexecstack'.
13/12/28 18:59:53 WARN util.NativeCodeLoader: Unable to load
native-hadoop library for your platform... using builtin-java classes
where applicable
This    1
a       4
as      2
do      1
do:     1
file    1
i       2
if      1
is      4
not     1
say     1
see     4
test    4
this    4
to      4
works.  1
 public static class IntSumReducer
            extends Reducer<Text, IntWritable, Text, IntWritable> {

        private IntWritable result = new IntWritable();

        public void reduce(Text key, Iterable<IntWritable> values,
                Context context
        ) throws IOException, InterruptedException {
            int sum = 0;
            for (IntWritable val : values) {
                sum += val.get();
            }
            if (sum >= 4) {
                result.set(sum);
                context.write(key, result);
            }
        }
    }