1

Gender) in HDFS, write a MapReduce Given a 10TB table Student (name, year, program to compute the following query. gpa, SELECTyear, AVG (gpa) FROM WHERE GROUP BY year Student gender'Male' Ans...

Question

Gender) in HDFS, write a MapReduce Given a 10TB table Student (name, year, program to compute the following query. gpa, SELECTyear, AVG (gpa) FROM WHERE GROUP BY year Student gender'Male' Ans...

gender) in HDFS, write a MapReduce Given a 10TB table Student (name, year, program to compute the following query. gpa, SELEC

gender) in HDFS, write a MapReduce Given a 10TB table Student (name, year, program to compute the following query. gpa, SELECTyear, AVG (gpa) FROM WHERE GROUP BY year Student gender'Male' Answer

Answers

Solution :

map (k, student) {
// here we can add the where clause condition
if (student.gender == 'male') {
// here we can get the data in map
stud1 = <student.year, student.gpa>
// here we can collect all the data
collect (student.year , stud1)
}
}
// Here each yr that reduce gets corresponds to a unique value in student.year field.
// Group by is implicitly done using the shuffling phase between map and reduce functions.

reduce(yr, studentList<stud1>) {
avg := 0
// for loop iterate upto the length of studentList
for each student in studentList {
// sum the gpa of all student
avg += student.gpa
}
// calculate the gpa avg of all students
avg := avg / size(studentList)
// assign map to stud2 variable
stud2 = <student.year, avg>
// store the data
store (yr, stud2)
}

1 map (k, student) // here we can add the where clause condition if (student.gendermale) // here we can get the data in map


Similar Solved Questions

1 answers
Chapter 10, Problem 60P from Fundamentals of Physics Extended please help!!!!
A 39.0 kg wheel, essentially a thinhoop with radius 1.12 m, is rotatingat 280 rev/min. It must be brought to a stop in 15.0 s.(a) How much work must be done to stop it?(b) What is the required average power?...
1 answers
Describe the categories of hazards that may be present in foods, including obesogens. Discuss some methods...
Describe the categories of hazards that may be present in foods, including obesogens. Discuss some methods for hazard control and/or prevention, along with which agency or regulatory body would oversee this aspect of food safety....
1 answers
(a) In the short run, outsourcing leads to job (b) In the long run, outsourcing benents...
(a) In the short run, outsourcing leads to job (b) In the long run, outsourcing benents domestic...
1 answers
How do you find the next three terms in the geometric sequence 4, -2, 1, -, ... ?
How do you find the next three terms in the geometric sequence 4, -2, 1, -, ... ?...
1 answers
In c++ code and test a function with prototype float except(int arg); that accepts an int...
In c++ code and test a function with prototype float except(int arg); that accepts an int argument and returns the expression 1.0 / arg if arg != 0; otherwise, except() throws an exception of type string. A suitable message might be “Error – attempt to divide by zero”....
1 answers
Economic Pipe Diameter Example Linseed oil is to be pumped from a tank to a bottling...
Economic Pipe Diameter Example Linseed oil is to be pumped from a tank to a bottling machine. The machine can fill and cap 30 two litre bottles in one minute. Determine the optimum size for the installation. Use the following parameters: C2 $0.05/(kW-hr) $0.00005/(W-hr) Cl $425/m2-2 t 7000 hr/yr F =...
1 answers
How do you calculate light frequency?
How do you calculate light frequency?...
1 answers
Your patient has a headache but has difficulty swallowing pills. The physician orders acetaminophen 650 mg...
Your patient has a headache but has difficulty swallowing pills. The physician orders acetaminophen 650 mg PO every 4 to 6 hours prn. You have acetaminophen elixir 160 mg in 5 mL. How much will you administer? Round to a whole number...
1 answers
Discuss the means by which structural bias, social inequities and racism undermine health and create challenges...
Discuss the means by which structural bias, social inequities and racism undermine health and create challenges to achieving health equity at organizational, community and societal levels in people with HIV/AIDS...
1 answers
The measurement error at each edge of a rectangular box is 5%. Approximate the maximum possible...
The measurement error at each edge of a rectangular box is 5%. Approximate the maximum possible error when measuring the volume of the box....
1 answers
1. Show all your work calculating the # of Cs based on the Mand (M+1]' peaks....
1. Show all your work calculating the # of Cs based on the Mand (M+1]' peaks. 2. Based on the mass spectrum, do you think your compound has a nitrogen atom? Explain. 3. Propose at least two molecular formulas based on the mass spectrum and calculate the exact mass of the parention. Is one of you...
1 answers
Is Convergad Cery divergent in care the fand was Egrad Convorgel ats value general election of...
is Convergad Cery divergent in care the fand was Egrad Convorgel ats value general election of the differential equation find the gener yho Ay' - 2 Castltetu...
1 answers
Suppose your firm is considering two mutually exclusive, required projects with the cash flows shown below....
Suppose your firm is considering two mutually exclusive, required projects with the cash flows shown below. The required rate of return on projects of both of their risk class is 12 percent, and that the maximum allowable payback and discounted payback statistic for the projects are 2 and 3 years, r...
1 answers
Will AgCl dissociate at a higher degree (be more soluble) in 0.05M KNO3 or in 0.05M...
Will AgCl dissociate at a higher degree (be more soluble) in 0.05M KNO3 or in 0.05M Ca(NO3)2? Explain why and show your math....
1 answers
Apter 6 Thinking Questions Fill in the diagra to explain the relationship between cellular respiration and...
apter 6 Thinking Questions Fill in the diagra to explain the relationship between cellular respiration and photosynthesis, Cellular respiration Glucose Photosynthesis Sunlight (kinetic Heat energy) energy Heat energy Potential energy 1 of 13 !!! Next > MacBook Air...
1 answers
14.22. Two spheres, each of mass m, can slide freely on a frictionless horizontal surface. Sphere...
14.22. Two spheres, each of mass m, can slide freely on a frictionless horizontal surface. Sphere A is moving at a speed vo 16 ft/s when it strikes sphere B which is at rest and the impact causes sphere B to break into two pieces, each of mass m/2. Knowing that 0.7 s after the collision one piece re...
1 answers
E10.12 (LO 1, 3) (Entries for Asset Acquisition, Including Self-Construction) Below are transactions related to Du...
E10.12 (LO 1, 3) (Entries for Asset Acquisition, Including Self-Construction) Below are transactions related to Duffner Company. a. The City of Pebble Beach gives the company 5 acres of land as a plant site. The fair value of this land is determined to be $81,000. b. 13,000 shares of common stock wi...

-- 0.055992--