Home | About | Sematext search-lucene.com search-hadoop.com
NEW: Monitor These Apps!
elasticsearch, apache solr, apache hbase, hadoop, redis, casssandra, amazon cloudwatch, mysql, memcached, apache kafka, apache zookeeper, apache storm, ubuntu, centOS, red hat, debian, puppet labs, java, senseiDB
 Search Hadoop and all its subprojects:

Switch to Plain View
Hadoop >> mail # user >> null value output from map...


Copy link to this message
-
null value output from map...


   In writing a Map/Reduce job I ran across something I found a little
strange.  I have a situation where I don't need a value output from map.
If I set the value of the value of OutputCollector<Text, IntWritable> to
null I get the following exception:

 

java.lang.NullPointerException

   at
org.apache.hadoop.mapred.MapTask$MapOutputBuffer.collect(MapTask.java:56
2)

 

    Looking at the code in MapTask.java ( Hadoop .19.1 ) it makes sense
why it would throw the exception:

 

      if (value.getClass() != valClass) {

        throw new IOException("Type mismatch in value from map: expected
"

                              + valClass.getName() + ", recieved "

                              + value.getClass().getName());

      }

 

  I guess my question is as follows: is it a bad idea/not normal to
collect a null value in map?  Outputting from reduce through
TextOutputFormat with a null value as I expect.  If the value is null
only they key and newline are output.  

 

   Any thoughts would be appreciated.

  

 

  

+
Richa Khandelwal 2009-03-13, 22:56
+
Owen OMalley 2009-03-13, 23:16
NEW: Monitor These Apps!
elasticsearch, apache solr, apache hbase, hadoop, redis, casssandra, amazon cloudwatch, mysql, memcached, apache kafka, apache zookeeper, apache storm, ubuntu, centOS, red hat, debian, puppet labs, java, senseiDB