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
Write multiple if statements:
lora16 [44]
Zrizorzlzfxxxgoxxxxpgxtoxxxhxuxyf
3 0
3 years ago
¿Cuándo se formarán cristales en una mezcla que se está evaporando?
Georgia [21]
Answer - La cristalización ye un procesu químicu pol cual a partir d'un gas, un líquidu o una disolución, los iones, átomos o molécules establecen enllaces hasta formar una rede cristalina, la unidá básica d'un cristal. La cristalización emplegar con bastante frecuencia en química para purificar una sustancia sólida.
5 0
3 years ago
Consider a W21x93. Determine the moment capacity of the beam. Assume the compression flange is not laterally braced and that the
OLga [1]

Answer:

The answer is "828.75"

Explanation:

Please find the correct question:

For W21x93 BEAM,

Z_x = 221.00 in^3 \\\\\to \frac{b_t}{2t_f} =4.53\\\\\to \frac{h}{t_w}=32.3

For A992 STREL,

F_y= 50\  ks

Check for complete section:

\to \frac{b_t}{2t_f} =4.53 < \frac{65}{\sqrt{f_y = 9.19}}\\\\\to \frac{h}{t_w} =32.3 < \frac{640}{\sqrt{f_y = 90.5}}

Design the strength of beam =\phi_b Z_x F_y\\\\

                                                =0.9 \times 221 \times 50\\\\=9945 \ in \ \ kips\\\\=\frac{9945}{12}\\\\= 828.75 \ft \ kips \\

8 0
3 years ago
............ ..........<br>​
sukhopar [10]

Answer:

...................

Explanation:

6 0
3 years ago
An ideal Otto cycle has a compression ratio of 9.2 and uses air as the working fluid. At the beginning of the compression proces
Allushta [10]

Answer:

(a) The amount of heat transferred to the air, q_{out} is 215.5077 kJ/kg

(b) The net work output, W_{net}, is 308.07 kJ/kg

(c) The thermal efficiency is 58.8%

(d) The Mean Effective Pressure, MEP, is 393.209 kPa

Explanation:

(a) The assumptions made are;

c_p = 1.005 kJ/(kg·K), c_v = 0.718 kJ/(kg·K), R = 0.287 kJ/(kg·K),

Process 1 to 2 is isentropic compression, therefore;

T_{2}= T_{1}\left (\dfrac{v_{1}}{v_{2}}  \right )^{k-1} = 300.15\times 9.2^{0.4} = 729.21 \, K

From;

\dfrac{p_{1}\times v_{1}}{T_{1}} = \dfrac{p_{2}\times v_{2}}{T_{2} }

We have;

p_{2} = \dfrac{p_{1}\times v_{1}\times T_{2}}{T_{1} \times v_{2}} = \dfrac{98\times 9.2\times 729.21}{300.15 } = 2190.43 \, kPa

Process 2 to 3 is reversible constant volume heating, therefore;

\dfrac{p_3}{T_3} =\dfrac{p_2}{T_2}

p₃ = 2 × p₂ = 2 × 2190.43 = 4380.86 kPa

T_3 = \dfrac{p_3 \times T_2}{p_2} =\dfrac{4380.86  \times 729.21}{2190.43} = 1458.42 \, K

Process 3 to 4 is isentropic expansion, therefore;

T_{3}= T_{4}\left (\dfrac{v_{4}}{v_{3}}  \right )^{k-1}

1458.42= T_{4} \times \left (9.2 \right )^{0.4}

T_4 = \dfrac{1458.42}{(9.2)^{0.4}}  = 600.3 \, K

q_{out} = m \times c_v \times (T_4 - T_1) = 0.718  \times (600.3 - 300.15) = 215.5077 \, kJ/kg

The amount of heat transferred to the air, q_{out} = 215.5077 kJ/kg

(b) The net work output, W_{net}, is found as follows;

W_{net} = q_{in} - q_{out}

q_{in} = m \times c_v \times (T_3 - T_2) = 0.718  \times (1458.42 - 729.21) = 523.574 \, kJ/kg

\therefore W_{net} = 523.574 - 215.5077 = 308.07 \, kJ/kg

(c) The thermal efficiency is given by the relation;

\eta_{th} = \dfrac{W_{net}}{q_{in}} \times 100=  \dfrac{308.07}{523.574} \times 100= 58.8\%

(d) From the general gas equation, we have;

V_{1} = \dfrac{m\times R\times T_{1}}{p_{1}} = \dfrac{1\times 0.287\times 300.15}{98} =0.897\, m^{3}/kg

The Mean Effective Pressure, MEP, is given as follows;

MEP =\dfrac{W_{net}}{V_1 - V_2} = \dfrac{W_{net}}{V_1 \times (1- 1/r)}= \dfrac{308.07}{0.897\times (1- 1/9.2)} = 393.209 \, kPa

The Mean Effective Pressure, MEP = 393.209 kPa.

3 0
3 years ago
Other questions:
  • To be able to write an ss-domain equation for a circuit, use partial fraction decomposition to separate the terms in this equati
    12·1 answer
  • A large spherical tank contains gas at a pressure of 400 psi. The tank is constructed of high-strength steel having a yield stre
    15·1 answer
  • Explain the purpose of the checkpoint mechanism. How often should checkpoints be performed?How does the frequency of checkpoints
    6·1 answer
  • Two forces, one of which double the other has resultant of 280N. if the direction of the large force is reversed and the remaini
    6·1 answer
  • For the pipe-fl ow-reducing section of Fig. P3.54, D 1 5 8 cm, D 2 5 5 cm, and p 2 5 1 atm. All fl uids are at 20 8 C. If V 1 5
    10·1 answer
  • Some chemical reaction is being run inside a sealed gas cylinder. During the reaction, a gaseous product is formed. The pressure
    14·1 answer
  • A sample of soil has a volume of 0.45 ft^3 and a weight of 53.3 lb. After being dried inan oven, it has a weight of 45.1 lb. It
    12·1 answer
  • CAN SOMEONE GIVE ME AND ANSWER AND EXPLANTION FOR ALL THESE QUESTIONS PLEASE, I AM STRUGGLING
    15·1 answer
  • Which of the following describes a tropical grassland environment?
    6·2 answers
  • Briefly explain the term soil sampling and outline its importance in building engineering works.
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!