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

Switch to Threaded 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:





    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.