1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
natka813 [3]
3 years ago
13

JAVA HADOOP MAPREDUCE

Engineering
1 answer:
taurus [48]3 years ago
3 0

Answer:

Explanation:

package PackageDemo;

import java.io.IOException;

import org.apache.hadoop.conf.Configuration;

import org.apache.hadoop.fs.Path;

import org.apache.hadoop.io.IntWritable;

import org.apache.hadoop.io.LongWritable;

import org.apache.hadoop.io.Text;

import org.apache.hadoop.mapreduce.Job;

import org.apache.hadoop.mapreduce.Mapper;

import org.apache.hadoop.mapreduce.Reducer;

import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;

import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;

import org.apache.hadoop.util.GenericOptionsParser;

public class WordCount {

public static void main(String [] args) throws Exception

{

Configuration c=new Configuration();

String[] files=new GenericOptionsParser(c,args).getRemainingArgs();

Path input=new Path(files[0]);

Path output=new Path(files[1]);

Job j=new Job(c,"wordcount");

j.setJarByClass(WordCount.class);

j.setMapperClass(MapForWordCount.class);

j.setReducerClass(ReduceForWordCount.class);

j.setOutputKeyClass(Text.class);

j.setOutputValueClass(IntWritable.class);

FileInputFormat.addInputPath(j, input);

FileOutputFormat.setOutputPath(j, output);

System.exit(j.waitForCompletion(true)?0:1);

}

public static class MapForWordCount extends Mapper<LongWritable, Text, Text, IntWritable>{

public void map(LongWritable key, Text value, Context con) throws IOException, InterruptedException

{

String line = value.toString();

String[] words=line.split(",");

for(String word: words )

{

Text outputKey = new Text(word.toUpperCase().trim());

IntWritable outputValue = new IntWritable(1);

con.write(outputKey, outputValue);

}

}

}

public static class ReduceForWordCount extends Reducer<Text, IntWritable, Text, IntWritable>

{

public void reduce(Text word, Iterable<IntWritable> values, Context con) throws IOException, InterruptedException

{

int sum = 0;

for(IntWritable value : values)

{

sum += value.get();

}

con.write(word, new IntWritable(sum));

}

}

}

You might be interested in
You don't have to notify employees that a lockout/tagout is about to begin?
Sergeu [11.5K]

Answer:

When the imposter is sus : O

Explanation:

3 0
3 years ago
A 3-oz serving of roasted, skinless chicken breast contains 140 Cal, 27 g of protein, 3 g of fat, 13 mg of calcium, and 64 mg of
Art [367]

Answer:

Explanation:

  • a) Given C [ cal pro fat calc sod]

              [140 27 3  13  64]

  • P = [cal pro fat calc sod]

     [180 4 11 24 662]

  • B = [cal pro fat calc sod]

      [50  5    1  82   20]

To find C+2P+3B = [140 27 3  13  64] + 2[180 4 11 24 662] + 3[50  5    1  82   20]

= [650  54  28  307  1448]

The entries represent skinless chicken breast , One-half cup of potato salad and One broccoli spear.

7 0
3 years ago
Describe the greatest power in design according to Aravena?
Ann [662]

Answer: Describe the greatest power in design according to Aravena? The subject of Aravena’s recent Futuna Lecture Series in New Zealand was ‘the power of design,’ which he described as ultimately being “the power of synthesis” because, increasingly, architects are dealing with complex issues and problems.

What are the three problems with global urbanization? 1. Degraded Environmental Quality ...

2. Overcrowding ...

3. Housing Problems ...

4. Unemployment ...

5. Development of Slums...

How could you use synthesis in your life to solve problems? Hence, synthesis is often not a one-time process of solution design but is used in combination with problem understanding and solution analysis to progress towards a more complete understanding of problems and solutions over time (see Applying the Systems Approach topic for a more complete discussion of the dynamics of this aspect of the approach).

I got all three answers

4 0
2 years ago
. A two-dimensional fluid motion is represented by a point vortex of strength Γ set at distance c from an infinite straight soli
Lostsunrise [7]

Answer:

The solution and complete explanation for the above question and mentioned conditions is given below in the attached document.i hope my explanation will help you in understanding this particular question.

Explanation:

8 0
3 years ago
can anyone give me tips on adding HP to my 2014 dodge charger SE? it uses the 3.6L220 CI 24 valve v6 vvt (variable valve timing)
marissa [1.9K]
<h2>ANSWER</h2><h2></h2>

I had a couple of answers for this, but when I checked nothing

was right, so im not sure.

<h2></h2>

5 0
3 years ago
Other questions:
  • HW6P2 (20 points) The recorded daily temperature (°F) in New York City and in Denver, Colorado during the month of January 2014
    10·1 answer
  • Atmospheric pressure is measured to be 14.769 psia. a. What would be the equivalent reading of a water barometer (inches of H20)
    11·1 answer
  • A heat engine is coupled with a dynamometer. The length of the load arm is 900 mm. The spring balance reading is 16. Applied wei
    11·1 answer
  • For the reactions of ketone body metabolism, _______.
    15·1 answer
  • Link AB is to be made of a steel for which the ultimate normal stress is 65 ksi. Determine the cross-sectional area of AB for wh
    14·1 answer
  • Before accurate distance standards, a cubit was the length of whose forearm?
    5·1 answer
  • ... is an actual sequence of interactions (i.e., an instance) describing one specific situation; a ... is a general sequence of
    9·1 answer
  • A satellite at a distance of 36,000 km from an earth station radiates a power of 10 W from an
    8·1 answer
  • Design for human-fit strategies include:
    12·1 answer
  • Tech A says that wiring diagrams are essentially a map of all of the electrical components and their connections. Tech B says th
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!