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 8704325
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T03:04:28+00:00 2026-06-13T03:04:28+00:00

public void map(LongWritable key, Text value, OutputCollector<Text, IntWritable> output, Reporter reporter) throws IOException {

  • 0
public void map(LongWritable key, Text value, OutputCollector<Text, IntWritable> output, Reporter reporter) throws IOException {
                String line = value.toString();
            StringTokenizer tokenizer = new StringTokenizer(line);
            while (tokenizer.hasMoreTokens()) {
              word.set(tokenizer.nextToken());
              output.collect(word, one);
            }
          }
        }

I trying to understand this basic program of map function in map-reduce, what the input paramsters are ? I could not find the definition of the map.

if any one can tell me what this function is doing it will be great

  • 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-13T03:04:30+00:00Added an answer on June 13, 2026 at 3:04 am

    I’m assuming this is used in a Map Reduce job with a TextInputFormat. I’m also assuming that “one” is some sort of globally scoped IntWritable representing the number one.

    In that case, the map function is called for every line in the file. The key is a number representing the offset of the start of the line in the file. The value is the textual value of the line.

    The map function here is splitting each line on whitespace using a StringTokenizer, and emitting each word and the number one as its output.

    Let’s say that your input file looks like this:

    Lorem ipsum dolor sit amet
    consectetur adipisicing elit
    sed do eiusmod tempor incididunt

    The mapper will emit the following keys and values:
    Lorem, 1
    ipsum, 1
    dolor, 1
    sit, 1
    amet, 1
    consectetur, 1
    adipisicing, 1
    elit, 1
    sed, 1
    do, 1
    eiusmod, 1
    tempor, 1
    incididunt, 1

    This is probably part of a word count map reduce job.

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

Sidebar

Related Questions

public void GrabData() throws IOException { try { BufferedReader br = new BufferedReader(new FileReader(data/500.txt));
public static class MapClass extends MapReduceBase implements Mapper<LongWritable, Text, Text, IntWritable> { private Text
I need to use java-legacy code with the following method: public void doit(Map <String,
My Map class is public static class MapClass extends Mapper<LongWritable, Text, Text, LongWritable> {
Hi have the following interface: public interface KeyValueStore { public void put(String key, byte[]
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.map); TextView lattv=(TextView)findViewById(R.id.lat); TextView lngtv=(TextView)findViewById(R.id.lng); JSONParstring jParser =
public void EditAndSave(String fileName) { Bitmap b = new Bitmap(fileName); /** * Edit bitmap
public static void Map<T>(Expression<Func<T, object >> expression) { var memberExpression = (expression.Body as UnaryExpression).Operand
Is volatile redundant in this code? public class Test { private volatile Map<String, String>
public void printList( ){ Node<E> p ; System.out.printf( [ ) ; for ( p=head.next

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.