a) Describe how to implement the following query in MapReduce
SELECT SUM(lo_revenue)
FROM lineorder, dwdate
WHERE lo_orderdate = d_datekey
AND d_yearmonth = 'Jan1994'
AND lo_discount BETWEEN 5 AND 7;
b) SELECT d_month, COUNT(DISTINCT d_sellingseason)
FROM dwdate
GROUP BY d_month
ORDER BY COUNT(DISTINCT d_sellingseason)
2) Consider a Hadoop job that processes an input data file of size equal to 120 disk blocks (120 different blocks, you can assume that HDFS replication factor is set to 1). The mapper in this job requires 1 minute to read and process a single block of data. Reducer requires 1 second (not 1 minute) to produce an answer for one key worth of values and there are a total of 4000 distinct keys (mappers generate a lot more key-value pairs, but there 4000 unique keys). Assume that each node has a reducer and that the keys are distributed evenly.
a) How long will it take to complete the job if you only had one Hadoop worker node? For the sake of simplicity, assume that that one mapper and one reducer are created on every node.
b) 10 Hadoop worker nodes?
c) 30 Hadoop worker nodes?
d) 50 Hadoop worker nodes?
e) Why (or why not) would the introduction of the combiner affect the runtime of this job?
f) How would changing the replication factor affect your answers for a-d?
You can ignore the network transfer costs as well as the possibility of node failure.
3)
a) Suppose you have a 6-node cluster with replication factor of 3. Describe what MapReduce has to do after it determines that a node has crashed while a job was being processed. For simplicity, assume that the failed node is not replaced and your cluster is reduced to 5 nodes. Specifically:
i) What does HDFS (the storage layer/NameNode) have to do in response to node failure in this case?
ii) What does MapReduce execution engine have to do to respond to the node failure? Assume that there was a job in progress because otherwise MapReduce does not need to do anything to address a failure.
b) Where does the Mapper store output key-value pairs before they are sent to Reducers?
c) Why can’t Reducers begin processing before Mapper phase is complete?
4) Using the SSBM schema (http://rasinsrv07.cstcis.cti.depaul.edu/CSC555/SSBM1/SSBM_schema_hive.sql) load the Part table into Hive (data available at http://rasinsrv07.cstcis.cti.depaul.edu/CSC555/SSBM1/part.tbl)
NOTE: The schema above is made for Hive, but by default Hive assumes ‘\t’ separated content. You will need to modify your CREATE TABLE statement to account for ‘|’ delimiter in the data or this won’t work.
Use Hive user defined function (i.e., SELECT TRANSFORM with weekday mapper is available here: http://rasinsrv07.cstcis.cti.depaul.edu/CSC555/weekday_mapper.py) to perform the following transformation on Part table (creating a new transformed table): for 2nd and 7th columns, split it into individual columns. That is, a value in 2nd column, ‘blush maroon’ now becomes 2nd and 3rd column with ‘blush’ and ‘maroon’ respectively. Similarly, the 7th column will be transformed from ‘STANDARD BURNISHED NICKEL’ into three columns with values ‘STANDARD’, ‘BURNISHED’, and ‘NICKEL‘.
Please be sure that you create the entire new table, not just the transformed column. You will add a total of 3 new columns to the original part table as a result.
Remember that your transform python code (split/join) should always use tab (‘\t’) between fields even if the source data is |-separated.
How many rows did you get? (if you get an error here, it is likely because vehicles.csv is not in HDFS)
Create the same ThreeColExtract file that you have in the previous assignment, by placing barrels08, city08 and charge120 into a new file using PigStorage .You want the STORE command to record output in HDFS. (discussed in p457, Pig Chapter, “Data Processing Operator section)
NOTE: You can use this to get one column:
OneCol = FOREACH VehicleData GENERATE barrels08;
Verify that the new file has been created and report the size of the newly created file.
(you can use quit to exit the grunt shell)
Submit a single document containing your written answers. Be sure that this document contains your name and “CSC 555 Assignment 3” at the top.