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
For better thermal control it is common to make catalytic reactors that have many tubes packed with catalysts inside a larger sh
Paul [167]

Answer:

the  pressure drop  is 0.21159 atm

Explanation:

Given that:

length of the reactor L = 2.5 m

inside diameter of the reactor d= 0.025 m

diameter of alumina sphere dp= 0.003 m

particle density  = 1300 kg/m³

the bed void fraction \in =  0.38

superficial mass flux m = 4684 kg/m²hr

The Feed is  methane with pressure P = 5 bar and temperature T = 400 K

Density of the methane gas \rho = 0.15 mol/dm ⁻³

viscosity of methane gas \mu = 1.429  x 10⁻⁵ Pas

The objective is to determine the pressure drop.

Let first convert the Density of the methane gas from 0.15 mol/dm ⁻³  to kg/m³

SO; we have :

Density =  0.15 mol/dm ⁻³  

Molar mass of methane gas (CH₄) = (12 + (1×4) ) = 16 mol

Density =  0.1 5 *\dfrac{16}{0.1^3}

Density =  2400

Density \rho_f =  2.4 kg/m³

Density = mass /volume

Thus;

Volume = mass/density

Volume of the methane gas =  4684 kg/m²hr / 2.4 kg/m³

Volume of the methane gas = 1951.666 m/hr

To m/sec; we have :

Volume of the methane gas = 1951.666 * 1/3600 m/sec = 0.542130 m/sec

Re = \dfrac{dV \rho}{\mu}

Re = \dfrac{0.025*0.5421430*2.4}{1.429*10^5}

Re=2276.317705

For Re > 1000

\dfrac{\Delta P}{L}=\dfrac{1.75 \rho_f(1- \in)v_o}{\phi_sdp \in^3}

\dfrac{\Delta P}{2.5}=\dfrac{(1.75 *2.4)(1- 0.38)*0.542130}{1*0.003 (0.38)^3}

\Delta P=8575.755212*2.5

\Delta = 21439.38803 \ Pa

To atm ; we have

\Delta P = \dfrac{21439.38803 }{101325}

\Delta P =0.2115903087  \ atm

ΔP  ≅  0.21159 atm

Thus; the  pressure drop  is 0.21159 atm

4 0
3 years ago
List five pieces of personal safety equipment which must be in everyday use in the workshop​
tatyana61 [14]

Answer:

safety glasses, hearing protection, respirator, work gloves, and work boots.

Explanation:

please give brainliest!! <3

3 0
3 years ago
A group of friends regularly enjoys white-water rafting, and they bring piston water guns to shoot water from one raft to anothe
nydimaria [60]

Answer:

Find attached the solution

Explanation:

6 0
3 years ago
Why do union members generally earn higher wages than non-union workers?
mariarad [96]

Answer:

the 1st option

Explanation:

7 0
3 years ago
Read 2 more answers
Recall from an earlier lecture that the relationship between the current through an inductor and the voltage across it is given
serious [3.7K]

Answer: Current = 2A

Explanation:

Inductor L = 10mH

E.m.f = 1 V

Time t = 20 ms

Using

V = Ldi/dt

di/dt = V/ L

di/dt = 1/10×10^-3

di/dt = 100

di = 100dt

Integrate both sides

I = 100(t1 - to)

Assume that initially there is no current through the inductor.

to = 0

I = 100 × t

I = 100 × 20×10^-3

I = 2A

7 0
3 years ago
Other questions:
  • Two parallel pipelines spaced 0.5 m apart are buried in soil having a thermal conductivity of 0.5 W/m·K. The pipes have outer di
    8·1 answer
  • Two previously undeformed cylindrical specimens of an alloy are to be strain hardened by reducing their cross-sectional areas (w
    8·1 answer
  • A photovoltaic panel of dimension 2m×4m is installed on the
    14·1 answer
  • Consider a half-wave rectifier circuit with a triangular-wave input of LaTeX: 6V6 V peak-to-peak amplitude and zero average valu
    6·1 answer
  • Discurso de Santiago Manuin Valera,
    10·1 answer
  • Air expands through a turbine from 10 bar, 900 K to 1 bar, 500 K. The inlet velocity is small compared to the exit velocity of 1
    5·1 answer
  • What is the current and power in a 120V circuit if the resistance 5Ω?
    11·2 answers
  • two students were talking student a was examining the lettuce leaves in a salad he was eating . he said, did you know im eating
    12·1 answer
  • Calculate the amount of current flowing through a 75-watt light bulb that is connected to a 120-volt circuit in your home.
    12·1 answer
  • On the attached image, #7.31. A is a pin
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!