Question
A dataset contains transaction id followed by price of items purchased. e.g. 1: 100 200 400 500 The syntax is txid: p1 p2 p3 where
A dataset contains transaction id followed by price of items purchased.
e.g. 1: 100 200 400 500
The syntax is txid: p1 p2 p3 where txid is transaction id and pi denotes price. Each transaction can have variable number of items.
1) Write a sequential program to generate the input data:
create 10million transaction records each containing a variable number of items randomly generated between 1 and 50, the price of each item is another random variable whose range is 100 to 5000.
2) Store the text file in HDFS.
3) Write a mapreduce program that partitions the text file into 5 classes as follows: class 1 contains transactions s.t. the item count is between 1-10, class2 for 11-20, and so on till class5 having 41-50 item count; and computes the total amount obtained for each class.
input:
1: 100 200 400 500
2: 10 50 5 25 89 20 35 91 78 82 150 125
3: 100 300
Here tx 1 and tx 3 belong to class 1 as the item count for each is between 1 - 10, while tx 2 belongs to class 2. The total amount from the sales for class 1 is the sum of the costs of all the items from tx 1 and tx 3.
e.g. output
class1, 1600
class2, 760
Step by Step Solution
3.51 Rating (164 Votes )
There are 3 Steps involved in it
Step: 1
The detailed answer for the above question is provided below 1 Sequential Program to Generate Input ...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started