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 73 : You have been given data in json format as below. {"first_name":"Ankit", "last_name":"Jain"} {"first_name":"Amir", "last_name":"Khan"} {"first_name":"Rajesh", "last_name":"Khanna"} {"first_name":"Priynka", "last_name":"Chopra"} {"first_name":"Kareena", "last_name":"Kapoor"} {"first_name":"Lokesh", "last_name":"Yadav"} Do the following activity 1 . create employee.json file locally. 2 . Load this file on hdfs 3 . Register this data as a temp table in Spark using Python. 4 . Write select query and print this data. 5 . Now save back this selected data in json format.
Correct Answer:
See the explanation for Step by Step Solution and configuration. Explanation: Solution : Step 1 : create employee.json tile locally. vi employee.json (press insert) past the content. Step 2 : Upload this tile to hdfs, default location hadoop fs -put employee.json Step 3 : Write spark script #lmport SQLContext from pyspark import SQLContext # Create instance of SQLContext sqIContext = SQLContext(sc) # Load json file employee = sqlContext.jsonFile("employee.json") # Register RDD as a temp table employee.registerTempTablef'EmployeeTab"} # Select data from Employee table employeelnfo = sqlContext.sql("select * from EmployeeTab"} #lterate data and print for row in employeelnfo.collect(): print(row) Step 4 : Write dataas a Text file employeelnfo.toJSON().saveAsTextFile("employeeJson1") Step 5: Check whether data has been created or not hadoop fs -cat employeeJsonl/part"