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
Suppose the loop is moving toward the solenoid (to the right). Will current flow through the loop down the front, up the front,
Tems11 [23]

Answer:

See explanation

Explanation:

The magnetic force is

F = qvB sin θ

We see that sin θ = 1, since the angle between the velocity and the direction of the field is 90º. Entering the other given quantities yields

F

=

(

20

×

10

−

9

C

)

(

10

m/s

)

(

5

×

10

−

5

T

)

=

1

×

10

−

11

(

C

⋅

m/s

)

(

N

C

⋅

m/s

)

=

1

×

10

−

11

N

6 0
3 years ago
Read 2 more answers
Tanya Pierce, President and owner of Florida Now Real Estate is seeking your assistance in designing a database for her business
const2013 [10]

Answer:

the answer is attributes for each entity

5 0
3 years ago
Water (density p-1000 is discharging from through a hole at the bottom of a graduated 71 cylinder. The mass flow rate exiting th
alexira [117]

Answer:

Please see attachment

Explanation:

Please see attachment

4 0
3 years ago
Consider a multiprocessor system and a multithreaded program written using the many-to-many threading model. Let the number of u
Montano1993 [528]

Answer:

At the point when the quantity of bit strings is not exactly the quantity of processors, at that point a portion of the processors would stay inert since the scheduler maps just part strings to processors and not client level strings to processors. At the point when the quantity of part strings is actually equivalent to the quantity of processors, at that point it is conceivable that the entirety of the processors may be used all the while. Be that as it may, when a part string obstructs inside the portion (because of a page flaw or while summoning framework calls), the comparing processor would stay inert. When there are more portion strings than processors, a blocked piece string could be swapped out for another bit string that is prepared to execute, in this way expanding the use of the multiprocessor system.When the quantity of part strings is not exactly the quantity of processors, at that point a portion of the processors would stay inert since the scheduler maps just bit strings to processors and not client level strings to processors. At the point when the quantity of bit strings is actually equivalent to the quantity of processors, at that point it is conceivable that the entirety of the processors may be used at the same time. Be that as it may, when a part string hinders inside the piece (because of a page flaw or while summoning framework calls), the relating processor would stay inert. When there are more portion strings than processors, a blocked piece string could be swapped out for another bit string that is prepared to execute, along these lines expanding the usage of the multiprocessor framework.

4 0
3 years ago
What is the primary function of NCEES?
charle [14.2K]

Answer:

It is a non profit organization that dedicates to licensing professional engineers and surveyors

Explanation:

6 0
3 years ago
Other questions:
  • If you are sampling a 50Hz signal, what is the minimum sampling rate necessary to prevent aliasing?Why?
    7·1 answer
  • An air conditioner using refrigerant R-134a as the working fluid and operating on the ideal vapor-compression refrigeration cycl
    12·1 answer
  • A mass of 8000 kg of slightly enriched uranium (2% U-235, 98% U-238) is exposed for 30 days in a reactor operating at (6.18) hea
    5·1 answer
  • Water (cp = 4180 J/kg·°C) enters the 2.5 cm internal diameter tube of a double-pipe counter-flow heat exchanger at 17°C at a rat
    7·1 answer
  • Selling a new vehicle pays a salesperson $1500. Selling a used vehicle pays a commission of 5% of the selling price. Write an in
    9·1 answer
  • A car accelerates uniformly from rest to 60 km/h in 30 s. What is its displacement during this time?
    7·1 answer
  • How do people eat with there noses shut
    12·2 answers
  • Suppose that we have a 1000 pF parallel-plate capacitor with air dielectric charged to 1000 V. The capacitors terminals are open
    13·1 answer
  • Who else hates this because i do
    12·2 answers
  • Name eight safety electrical devices including their functions and effects if not present.​
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!