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

Http response indicated failure postmates - Apple compensation policy - Classification of fingerprints henry system - Sugar bowl case study analysis - Lightroom delete from disk shortcut - Standard error of measurement - Reclaiming social work aberdeen - 5 reflexive verbs in spanish - Advantages and disadvantages of payback - Business ethics - Segmentation samsung mobile - Surface area of composite shapes - Luisa Anxiety Diagnosis and Assessment - Smallest ocean in the world is - Graph of electric potential vs distance - Sf2 polar or nonpolar - Climate change 2007 the physical science basis - Www wiley com college sekaran - Eyeglassomatic manufactures eyeglasses for different retailers - Distinguished achievers list 2009 - SCAAP TEST - Lesson plan on simple equations class 7 - Czech office for surveying mapping and cadastre - Like dreaming backwards monologue natalie - How to track gautrain bus - Box hill tafe orientation day - One discussion and 2 replies - Pdsq scoring - Dan murphy's hobart specials - Looking For Best Assignment Writer? - Sdsu net price calculator - Wwi wilson's appeal for neutrality august 19 1914 - Unsw endnote find full text - Red veined sorrel wikipedia - I need 1000 words essay in business through research internet - Coca cola human rights violations - What is parochialism in management - Deakin late submission policy - Jess's or jess grammar - Marie curie fellows association - Fortinet study guide pdf - Igcse questions on the moving finger - The ones who walk away from omelas mla citation - Abbreviation for air conditioner - Time and distance overcome - Dawn brancheau death filmed - Siemens builds a strategy oriented hr system solution - The transparent portion of the fibrous tunic is the - Adjusted hospital autopsy rate calculator - Need presentation based on uploaded document - History of hyperbolic functions - 1.6 mm corrosion allowance - Assessment (for Dr. Fattima) - MBA-599 - Discussion #1 - Define electron dot diagram - To the power of 10 - 1 fte how many hours - Biology assignment for human physiology - Analysis everyday use by alice walker - Acsm org docs brochures resistance training pdf - Cocky mart new listings - Basic unit of dna - Is social business working out - Bournemouth bus routes map - Reactions in aqueous solutions lab key - What I Will Do Proactively to Prevent or Reduce Misbehavior - Draw erd in visio - Spanish pronunciation cheat sheet - Using sources effectively 5th edition pdf - 20 examples of proper noun - 1100 u gs3 24 - Writing assignment, due tonight 11pm can you have done? - Top10 chemically competent cells - Miles into kilometers formula - There are two factories located at p and q - Nursing care plan for gestational diabetes - Applied statistics for public and nonprofit administration 7th edition - Vision statement for coca cola - Cloud Computing - Mark gungor the tale of two brains - Rio salado chm 130 midterm answers - Artifact that embodies ethical values - Modify the following sql command so that the rep_id - Business law assignment 1 - 109/8 pottery court brunswick - What does web 1.0 primarily offer - Project assginment - Key organizational enablers for effective demand management - Australian communities foundation limited - Uber technologies inc case study - MINI CASE ANALYSIS 1000 WORDS - Pronombres objeto directo e indirecto - Https www thebalance com communication skills list 2063779 - Priceline case study - Global Health fans D3 - Surface area to volume ratio experiment potato - 2021 vce exam dates - Compiled a thousand and one arabian nights - Sc4730 environmental science - State and Federal Courts