Valid CCA175 Dumps shared by EduDump.com for Helping Passing CCA175 Exam! EduDump.com now offer the newest CCA175 exam dumps, the EduDump.com CCA175 exam questions have been updated and answers have been corrected get the newest EduDump.com CCA175 dumps with Test Engine here:
CORRECT TEXT Problem Scenario 75 : You have been given MySQL DB with following details. user=retail_dba password=cloudera database=retail_db table=retail_db.orders table=retail_db.order_items jdbc URL = jdbc:mysql://quickstart:3306/retail_db Please accomplish following activities. 1. Copy "retail_db.order_items" table to hdfs in respective directory p90_order_items . 2. Do the summation of entire revenue in this table using pyspark. 3. Find the maximum and minimum revenue as well. 4. Calculate average revenue Columns of ordeMtems table : (order_item_id , order_item_order_id , order_item_product_id, order_item_quantity,order_item_subtotal,order_ item_subtotal,order_item_product_price)
Correct Answer:
See the explanation for Step by Step Solution and configuration. Explanation: Solution : Step 1 : Import Single table . sqoop import --connect jdbc:mysql://quickstart:3306/retail_db -username=retail_dba - password=cloudera -table=order_items --target -dir=p90 ordeMtems --m 1 Note : Please check you dont have space between before or after '=' sign. Sqoop uses the MapReduce framework to copy data from RDBMS to hdfs Step 2 : Read the data from one of the partition, created using above command. hadoop fs -cat p90_order_items/part-m-00000 Step 3 : In pyspark, get the total revenue across all days and orders. entire TableRDD = sc.textFile("p90_order_items") #Cast string to float extractedRevenueColumn = entireTableRDD.map(lambda line: float(line.split(",")[4])) Step 4 : Verify extracted data for revenue in extractedRevenueColumn.collect(): print revenue #use reduce'function to sum a single column vale totalRevenue = extractedRevenueColumn.reduce(lambda a, b: a + b) Step 5 : Calculate the maximum revenue maximumRevenue = extractedRevenueColumn.reduce(lambda a, b: (a if a>=b else b)) Step 6 : Calculate the minimum revenue minimumRevenue = extractedRevenueColumn.reduce(lambda a, b: (a if a<=b else b)) Step 7 : Caclculate average revenue count=extractedRevenueColumn.count() averageRev=totalRevenue/count