Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9137513
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T09:06:44+00:00 2026-06-17T09:06:44+00:00

I thought that they refer to the Reducer but in my program I have

  • 0

I thought that they refer to the Reducer but in my program I have

public static class MyMapper extends
Mapper< LongWritable, Text, Text, Text >

and

public static class MyReducer extends
Reducer< Text, Text, NullWritable, Text >

so if I have

job.setOutputKeyClass( NullWritable.class );

job.setOutputValueClass( Text.class );

I get the following Exception

Type mismatch in key from map: expected org.apache.hadoop.io.NullWritable, recieved org.apache.hadoop.io.Text

but if I have

job.setOutputKeyClass( Text.class );

there is no problem.

Is there sth wrong with my code or this happens because of NullWritable or sth else?

Also do I have to use job.setInputFormatClass and job.setOutputFormatClass? Because my programs runs correctly without them.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T09:06:45+00:00Added an answer on June 17, 2026 at 9:06 am

    Calling job.setOutputKeyClass( NullWritable.class ); will set the types expected as output from both the map and reduce phases.

    If your Mapper emits different types than the Reducer, you can set the types emitted by the mapper with the JobConf‘s setMapOutputKeyClass() and setMapOutputValueClass() methods. These implicitly set the input types expected by the Reducer.

    (source: Yahoo Developer Tutorial)

    Regarding your second question, the default InputFormat is the TextInputFormat. This treats each line of each input file as a separate record, and performs no parsing. You can call these methods if you need to process your input in a different format, here are some examples:

    InputFormat             | Description                                      | Key                                      | Value
    --------------------------------------------------------------------------------------------------------------------------------------------------------
    TextInputFormat         | Default format; reads lines of text files        | The byte offset of the line              | The line contents
    KeyValueInputFormat     | Parses lines into key, val pairs                 | Everything up to the first tab character | The remainder of the line
    SequenceFileInputFormat | A Hadoop-specific high-performance binary format | user-defined                             | user-defined
    

    The default instance of OutputFormat is TextOutputFormat, which writes (key, value) pairs on individual lines of a text file. Some examples below:

    OutputFormat             | Description
    ---------------------------------------------------------------------------------------------------------
    TextOutputFormat         | Default; writes lines in "key \t value" form
    SequenceFileOutputFormat | Writes binary files suitable for reading into subsequent MapReduce jobs
    NullOutputFormat         | Disregards its inputs
    

    (source: Other Yahoo Developer Tutorial)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

After I thought that I've understood how they work, I tried this: NSString *str1
I thought that this was easier… I have a asp:hyperlink control, with target=_blank ,
I thought that layout is just a widget that keeps more widgets inside. But
I have various classes that wrap an IntPtr . They don't store their own
I'm building a system that allows an organisations members to refer newsletters they receive
After much reading, it seems that when people say, browser engine, they refer to
I have a gem that has some ActiveRecord-derived models. They are tested and work.
So something like: public static class StaticClass {} public class InstanceClass { static StaticClass
I have a collection of csproj files that all refer to the same set
I thought that by convention, only methods with an exclamation mark altered the object.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.