Loading...

Messages

Proposals

Stuck in your homework and missing deadline? Get urgent help in $10/Page with 24 hours deadline

Get Urgent Writing Help In Your Essays, Assignments, Homeworks, Dissertation, Thesis Or Coursework & Achieve A+ Grades.

Privacy Guaranteed - 100% Plagiarism Free Writing - Free Turnitin Report - Professional And Experienced Writers - 24/7 Online Support

Hadoop streaming python word count example

06/12/2021 Client: muhammad11 Deadline: 2 Day

1. In class we wrote a MapReduce program in Java to compute the word counts for any given input. In this assignment, you will repeat solving the same problem but using Hadoop streaming.

2. Create two scripts in Python namely wordcount_map.py and wordcount_reduce.py to be used by the mappers and reducers of the streaming job.

3. Your script files must be executable (consider chmod command), and must include the necessary shebang (like in the attached script files).

4. Attached are the script files we used in class to demonstrate Hadoop streaming, namely: maxtemp_map.py and maxtemp_reduce.py. They can help you to get started.

5. Recall the streaming command:

$ mapred streaming \

-files , \

-mapper \

-reducer \

-input \

-output

(extra options: -combiner, -numReduceTasks, etc.)

MaxTemperature Example file is the program file discussed in Class.

Mapper for the Maximum temperature Example:

import java.io.IOException;

import org.apache.hadoop.io.IntWritable;

import org.apache.hadoop.io.LongWritable;

import org.apache.hadoop.io.Text;

import org.apache.hadoop.mapreduce.Mapper;

public class MaxTemperatureMapper

extends Mapper {

private static final int MISSING = 9999;

@Override

public void map(LongWritable key, Text value, Context context)

throws IOException, InterruptedException {

String line = value.toString();

String year = line.substring(15, 19);

int airTemperature;

if (line.charAt(87) == '+') { // parseInt doesn't like leading plus signs

airTemperature = Integer.parseInt(line.substring(88, 92));

} else {

airTemperature = Integer.parseInt(line.substring(87, 92));

}

String quality = line.substring(92, 93);

if (airTemperature != MISSING && quality.matches("[01459]")) {

context.write(new Text(year), new IntWritable(airTemperature));

}

}

}

Reducer for the max temperature example

import java.io.IOException;
import org.apache.hadoop.io.IntWritable;

import org.apache.hadoop.io.Text;

import org.apache.hadoop.mapreduce.Reducer;

public class MaxTemperatureReducer

extends Reducer {

@Override

public void reduce(Text key, Iterable values, Context context)

throws IOException, InterruptedException {

int maxValue = Integer.MIN_VALUE;

for (IntWritable value : values) {

maxValue = Math.max(maxValue, value.get());

}

context.write(key, new IntWritable(maxValue));

}

}

Application to find the maximum temperature in the weather dataset

import org.apache.hadoop.fs.Path;

import org.apache.hadoop.io.IntWritable;

import org.apache.hadoop.io.Text;

import org.apache.hadoop.mapreduce.Job;

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

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

public class MaxTemperature {

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

if (args.length != 2) {

System.err.println("Usage: MaxTemperature ");

System.exit(-1);

}

Job job = new Job();

job.setJarByClass(MaxTemperature.class);

job.setJobName("Max temperature");

FileInputFormat.addInputPath(job, new Path(args[0]));

FileOutputFormat.setOutputPath(job, new Path(args[1]));

job.setMapperClass(MaxTemperatureMapper.class);

job.setReducerClass(MaxTemperatureReducer.class);

job.setOutputKeyClass(Text.class);

job.setOutputValueClass(IntWritable.class);

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

Homework is Completed By:

Writer Writer Name Amount Client Comments & Rating
Instant Homework Helper

ONLINE

Instant Homework Helper

$36

She helped me in last minute in a very reasonable price. She is a lifesaver, I got A+ grade in my homework, I will surely hire her again for my next assignments, Thumbs Up!

Order & Get This Solution Within 3 Hours in $25/Page

Custom Original Solution And Get A+ Grades

  • 100% Plagiarism Free
  • Proper APA/MLA/Harvard Referencing
  • Delivery in 3 Hours After Placing Order
  • Free Turnitin Report
  • Unlimited Revisions
  • Privacy Guaranteed

Order & Get This Solution Within 6 Hours in $20/Page

Custom Original Solution And Get A+ Grades

  • 100% Plagiarism Free
  • Proper APA/MLA/Harvard Referencing
  • Delivery in 6 Hours After Placing Order
  • Free Turnitin Report
  • Unlimited Revisions
  • Privacy Guaranteed

Order & Get This Solution Within 12 Hours in $15/Page

Custom Original Solution And Get A+ Grades

  • 100% Plagiarism Free
  • Proper APA/MLA/Harvard Referencing
  • Delivery in 12 Hours After Placing Order
  • Free Turnitin Report
  • Unlimited Revisions
  • Privacy Guaranteed

6 writers have sent their proposals to do this homework:

Assignment Guru
Online Assignment Help
Pro Writer
Instant Assignment Writer
Engineering Exam Guru
Helping Hand
Writer Writer Name Offer Chat
Assignment Guru

ONLINE

Assignment Guru

I am a professional and experienced writer and I have written research reports, proposals, essays, thesis and dissertations on a variety of topics.

$35 Chat With Writer
Online Assignment Help

ONLINE

Online Assignment Help

I am an academic and research writer with having an MBA degree in business and finance. I have written many business reports on several topics and am well aware of all academic referencing styles.

$47 Chat With Writer
Pro Writer

ONLINE

Pro Writer

I have done dissertations, thesis, reports related to these topics, and I cover all the CHAPTERS accordingly and provide proper updates on the project.

$39 Chat With Writer
Instant Assignment Writer

ONLINE

Instant Assignment Writer

I am an academic and research writer with having an MBA degree in business and finance. I have written many business reports on several topics and am well aware of all academic referencing styles.

$23 Chat With Writer
Engineering Exam Guru

ONLINE

Engineering Exam Guru

I have read your project description carefully and you will get plagiarism free writing according to your requirements. Thank You

$24 Chat With Writer
Helping Hand

ONLINE

Helping Hand

I am a professional and experienced writer and I have written research reports, proposals, essays, thesis and dissertations on a variety of topics.

$40 Chat With Writer

Let our expert academic writers to help you in achieving a+ grades in your homework, assignment, quiz or exam.

Similar Homework Questions

Plc stl programming examples - Threats of substitutes in the airline industry - Nursing Assignmet - Diversity in hospitality industry - Social validity is an indicator that demonstrates the quality of single subject research. - Disney annual report 2015 - Mitel 5312 ip phone instructions - Principles of training variation - Delaney company leases an automobile with a fair value - Belly flop bernie dives from atop a tall flagpole - Repaso completa el siguiente resumen gramatical - Double block and bleed p&id - 4 spheres of earth - Factor tree of 18 - Xtm air compressor 160 lpm 150 psi review - Expectancy value theory definition - Skill related components of fitness balance - Harmonizer is a maintenance role in groups - Macbeth and a simple plan - Derek bok protecting freedom of expression on the campus analysis - Definition of appropriation in art - Health Assessment Nursing assignment - Week 6 Individual Project - Research Paper - Example of 6x6 rule powerpoint - Acu extension request form - 0.00001 in scientific notation - Which synonym describes the greatest degree of regret - Gcse music structure and form - What is an iq score of 110 - Rob is responsible for estimating a work package - Call and response taking a stand bell hooks - COM303 Week 4 Discussion 10 - Boy in the striped pajamas discussion questions answers - Guardianship qld fact sheet - Https phet colorado edu en simulation legacy projectile motion - A day in the lab worksheet answers - Body and movement concepts - Zero zip nada nyt crossword - Challenges in integrated marketing communication ppt - Dulce et decorum est quiz - Invitation letter for speaker in a seminar - Swot analysis of the walt disney company - Co teaching models handout - Barbie doll marge piercy tone - Anthropology - Night journey as either classical ballet or modern dance - With the nickel sized hail and the damaging winds lyrics - Dunn inc is a privately held furniture - Tennis court sizes australia - 350 words - The following balances were taken from the books of alonzo corp. on december 31, 2017. - Compare Displaced Persons (Plagiarism Checked) Submit Assignment - Two paths diverged from the main road answers com - Benchmark evidence based practice project paper on diabetes - Ptc creo 5.0 system requirements - Jonathan's wife in dracula crossword clue - Fill in each blank with the appropriate athlete's name based on the perfil reading. - Write a research paper in APA 6th style - What is the prospector in the glass castle - 28437 n 108th way scottsdale - Quality management framework template - Examples of government accounting journal entries - Sample soap note for normal physical exam - The fashion channel case study solutions - Drm radio receiver in india - Normalization table of hospital management system - Alice blue gown chords - Wsq competency standards - Preterite ar verbs worksheet answers - 100 point vehicle inspection checklist pdf - Cause and effect argument essay eng 106 - Nutri quiz questions with answers - Affidavit family court wa - Transformational leadership and knowledge and knowledge sharing within an organization. - Notes payable due in six months are reported as - Medicare assignment form db2 ot - Token economy how blockchains and smart contracts revolutionize the economy - Concepts and Challenges in Nursing Discussion board prompt 200 WORDS - Strategic groups beer industry - The combining form encephal o means - Enzychrom glucose assay kit - An in formal paper - Kirks build passion led us here - 50cc scooter cdi wiring diagram - School age child observation examples - Value based care - Asd assist defence gov au - Unsymmetrical fault analysis in power system - Ramort company reports the following - 2015 economics hsc answers - New heritage doll company capital budgeting pdf - Esl speaking rubric template - Mark twain two ways of seeing a river - Graphic organizer. - An average computer mouse inspector - Life history interview essay - Normal jvp above sternal angle - Cutmaster 101 service manual - Health Insurance Project - Assume the following relationships for the brauer corp