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]
2 years ago
13

JAVA HADOOP MAPREDUCE

Engineering
1 answer:
taurus [48]2 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
A murder in a downtown office building has been widely publicized. You’re a police detective and receive a phone call from a dig
BaLLatris [955]

Answer:

Considering the plain view doctrine, which is an exception to the warrant requirement of the Fourth Amendment, is applied by law enforcement officers and courts who can seize evidence of a crime without a warrant, if the officer observes the evidence in plain view.

Explanation:

For any digital information related to a murder case that has been seized under the plain view doctrine to be used to convict you of a crime, has to comply with three conditions:

1.  The digital evidence must be in out in the open, and easily observable by the officer, this is what "plain view" refers to.

2. The officer must have a legal right to be where he got the information related to the case.

3. The 'incriminating' character of the information must be a clear hint of the murder to fall under the plain view doctrine and the officer´s experience will help him determining whether the information is evidence or not, upon probable cause related to a crime.

7 0
3 years ago
Read 2 more answers
Un material determinado tiene un espesor de 30 cm y una conductividad térmica (K) de 0,04 w/m°C. En un instante dado la distribu
aksik [14]

Answer:

Para x=0:

\phi=1.2 W/m^{2}  

Para x=30 cm:

\phi=-2.4 W/m^{2}  

Explanation

Podemos utilizar la ley de Fourier par determinar el flujo de calor:

\phi=-k\frac{dT}{dx}(1)

Por lo tanto debemos encontrar la derivada de T(x) con respecto a x primero.

Usando la ley de potencia para la derivda, tenemos:

\frac{dT(x)}{dx}=300x-30

Remplezando esta derivada en (1):

\phi=-0.04(300x-30)

Para x=0:

\phi=0.04(30)

\phi=1.2 W/m^{2}  

Para x=30 cm:

\phi=-0.04(300*0.3-30)

\phi=-2.4 W/m^{2}    

Espero que te haya ayudado!

4 0
3 years ago
When you see a street with white markings only, what kind of street is it?
Georgia [21]

Answer:

it's a one way street

3 0
3 years ago
a vertical cylindrical container is being cooled in ambient air at 25 °C with no air circulation. if the initial temperature of
Sloan [31]

Answer:

the surface heat-transfer coefficient due to natural convection during the initial cooling period.  = 4.93 w/m²k

Explanation:

check attachement for answer explanation

7 0
3 years ago
Read 2 more answers
A rigid insulated tank is divided into 2 equal compartments by a thin rigid partition. One of the compartments contains air, ass
Illusion [34]
Https://www.slader.com/discussion/question/an-insulated-rigid-tank-is-divided-into-two-equal-parts-by-a-partition-initially-one-part-contains-4/



there will be the answer

6 0
2 years ago
Other questions:
  • 2.14 (a) Using series/parallel resistance reductions, find the equivalent resistance between terminals A and B in the circuit of
    14·1 answer
  • 2. In the above figure, what type of cylinder arrangement is shown in the figure above?
    9·1 answer
  • Which of the following describes fibers? a)- Single crystals with extremely large length-to-diameter ratios. b)- Polycrystalline
    10·1 answer
  • Power is a fundamental dimension. a) True b) False
    15·1 answer
  • Exhaust gases entering a convergent nozzle have a total pressure (Pt) of 200 kPa and total temperature (Tt) of 800 K. The gases
    5·2 answers
  • Write what you already know about college majors. What are they? Can you think of any examples? When do you have to pick one? Ca
    10·2 answers
  • What can you add to a seatbelt ??<br> HELP ASAP
    15·1 answer
  • Please what is dif<br>ference between building technology and building engineering.​
    14·2 answers
  • The Imager for Mars Pathfinder (IMP) is an imaging system. It has two camera channels. Each channel has color capability. This i
    7·1 answer
  • Reason fo I.EE regulations in electrical installations​
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!