Note that there are some explanatory texts on larger screens.

plurals
  1. POSerialization using ArrayWritable seems to work in a funny way
    primarykey
    data
    text
    <p>I was working with <code>ArrayWritable</code>, at some point I needed to check how Hadoop serializes the <code>ArrayWritable</code>, this is what I got by setting <code>job.setNumReduceTasks(0)</code>:</p> <pre><code>0    IntArrayWritable@10f11b8 3    IntArrayWritable@544ec1 6    IntArrayWritable@fe748f 8    IntArrayWritable@1968e23 11    IntArrayWritable@14da8f4 14    IntArrayWritable@18f6235 </code></pre> <p>and this is the test mapper that I was using:</p> <pre><code>public static class MyMapper extends Mapper&lt;LongWritable, Text, LongWritable, IntArrayWritable&gt; { public void map(LongWritable key, Text value, Context context) throws IOException, InterruptedException { int red = Integer.parseInt(value.toString()); IntWritable[] a = new IntWritable[100]; for (int i =0;i&lt;a.length;i++){ a[i] = new IntWritable(red+i); } IntArrayWritable aw = new IntArrayWritable(); aw.set(a); context.write(key, aw); } } </code></pre> <p><code>IntArrayWritable</code> is taken from the example given in the javadoc: <a href="http://hadoop.apache.org/common/docs/current/api/org/apache/hadoop/io/ArrayWritable.html" rel="nofollow">ArrayWritable</a>.</p> <pre><code>import org.apache.hadoop.io.ArrayWritable; import org.apache.hadoop.io.IntWritable; public class IntArrayWritable extends ArrayWritable { public IntArrayWritable() { super(IntWritable.class); } } </code></pre> <p>I actually checked on the source code of Hadoop and this makes no sense to me. <code>ArrayWritable</code> should not serialize the class name and there is no way that an array of 100 <code>IntWritable</code> can be serialized using 6/7 hexadecimal values. The application actually seems to work just fine and the reducer deserializes the right values... What is happening? What am I missing?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload