Question # 1
Problem Scenario 89 : You have been given below patient data in csv format, patientID,name,dateOfBirth,lastVisitDate 1001,Ah Teck,1991-12-31,2012-01-20 1002,Kumar,2011-10-29,2012-09-20 1003,Ali,2011-01-30,2012-10-21 Accomplish following activities. 1. Find all the patients whose lastVisitDate between current time and '2012-09-15' 2. Find all the patients who born in 2011 3. Find all the patients age 4. List patients whose last visited more than 60 days ago 5. Select patients 18 years old or younger
|
Answer: See the explanation for Step by Step Solution and configuration. Explanation: Solution : Step 1: hdfs dfs -mkdir sparksql3 hdfs dfs -put patients.csv sparksql3/ Step 2 : Now in spark shell // SQLContext entry point for working with structured data val sqlContext = neworg.apache.spark.sql.SQLContext(sc) // this is used to implicitly convert an RDD to a DataFrame. import sqlContext.impIicits._ // Import Spark SQL data types and Row. import org.apache.spark.sql._ // load the data into a new RDD val patients = sc.textFilef'sparksqIS/patients.csv") // Return the first element in this RDD patients.first() //define the schema using a case class case class Patient(patientid: Integer, name: String, dateOfBirth:String , lastVisitDate: String) // create an RDD of Product objects val patRDD = patients.map(_.split(M,M)).map(p => Patient(p(0).tolnt,p(1),p(2),p(3))) patRDD.first() patRDD.count(} // change RDD of Product objects to a DataFrame val patDF = patRDD.toDF() // register the DataFrame as a temp table patDF.registerTempTable("patients"} // Select data from table val results = sqlContext.sql(......SELECT* FROM patients '.....) // display dataframe in a tabular format results.show() //Find all the patients whose lastVisitDate between current time and '2012-09-15' val results = sqlContext.sql(......SELECT * FROM patients WHERE TO_DATE(CAST(UNIX_TIMESTAMP(lastVisitDate, 'yyyy-MM-dd') AS TIMESTAMP)) BETWEEN '2012-09-15' AND current_timestamp() ORDER BY lastVisitDate......) results.showQ /.Find all the patients who born in 2011 val results = sqlContext.sql(......SELECT * FROM patients WHERE YEAR(TO_DATE(CAST(UNIXJTlMESTAMP(dateOfBirth, 'yyyy-MM-dd') AS TIMESTAMP))) = 2011 ......) results. show() //Find all the patients age val results = sqlContext.sql(......SELECT name, dateOfBirth, datediff(current_date(), TO_DATE(CAST(UNIX_TIMESTAMP(dateOfBirth, 'yyyy-MM-dd') AS TlMESTAMP}}}/365 AS age FROM patients Mini > results.show() //List patients whose last visited more than 60 days ago - List patients whose last visited more than 60 days ago val results = sqlContext.sql(......SELECT name, lastVisitDate FROM patients WHERE datediff(current_date(), TO_DATE(CAST(UNIX_TIMESTAMP[lastVisitDate, 'yyyy-MM-dd') AS T1MESTAMP))) > 60......); results. showQ; - Select patients 18 years old or younger SELECT' FROM patients WHERE TO_DATE(CAST(UNIXJTlMESTAMP(dateOfBirth, 'yyyy-MM-dd') AS TIMESTAMP}) > DATE_SUB(current_date(),INTERVAL 18 YEAR); val results = sqlContext.sql(......SELECT' FROM patients WHERE TO_DATE(CAST(UNIX_TIMESTAMP(dateOfBirth, 'yyyy-MM-dd') AS TIMESTAMP)) > DATE_SUB(current_date(), T8*365)......); results. showQ; val results = sqlContext.sql(......SELECT DATE_SUB(current_date(), 18*365) FROM patients......); results.show();
Question # 2
Problem Scenario 11 : You have been given following mysql database details as well as other info. user=retail_dba password=cloudera database=retail_db jdbc URL = jdbc:mysql://quickstart:3306/retail_db Please accomplish following. 1. Import departments table in a directory called departments. 2. Once import is done, please insert following 5 records in departments mysql table. Insert into departments(10, physics); Insert into departments(11, Chemistry); Insert into departments(12, Maths); Insert into departments(13, Science); Insert into departments(14, Engineering); 3. Now import only new inserted records and append to existring directory . which has been created in first step.
|
Answer: See the explanation for Step by Step Solution and configuration. Explanation: Solution : Step 1 : Clean already imported data. (In real exam, please make sure you dont delete data generated from previous exercise). hadoop fs -rm -R departments Step 2 : Import data in departments directory. sqoop import \ -connect jdbc:mysql://quickstart:3306/retail_db \ -username=retail_dba \ -password=cloudera \ -table departments \ "target-dir/user/cloudera/departments Step 3 : Insert the five records in departments table. mysql -user=retail_dba -password=cloudera retail_db Insert into departments values(10, "physics"); Insert into departments values(11, "Chemistry"); Insert into departments values(12, "Maths"); Insert into departments values(13, "Science"); Insert into departments values(14, "Engineering"); commit; select' from departments; Step 4 : Get the maximum value of departments from last import, hdfs dfs -cat /user/cloudera/departments/part* that should be 7 Step 5 : Do the incremental import based on last import and append the results. sqoop import \ -connect "jdbc:mysql://quickstart.cloudera:330G/retail_db" \ ~username=retail_dba \ -password=cloudera \ -table departments \ -target-dir /user/cloudera/departments \ -append \ -check-column "department_id" \ -incremental append \ -last-value 7 Step 6 : Now check the result. hdfs dfs -cat /user/cloudera/departments/part"
Question # 3
Problem Scenario 1: You have been given MySQL DB with following details. user=retail_dba password=cloudera database=retail_db table=retail_db.categories jdbc URL = jdbc:mysql://quickstart:3306/retail_db Please accomplish following activities. 1. Connect MySQL DB and check the content of the tables. 2. Copy "retaildb.categories" table to hdfs, without specifying directory name. 3. Copy "retaildb.categories" table to hdfs, in a directory name "categories_target". 4. Copy "retaildb.categories" table to hdfs, in a warehouse directory name "categories_warehouse".
|
Answer: See the explanation for Step by Step Solution and configuration. Explanation: Solution : Step 1 : Connecting to existing MySQL Database mysql -user=retail_dba - password=cloudera retail_db Step 2 : Show all the available tables show tables; Step 3 : View/Count data from a table in MySQL select count(1} from categories; Step 4 : Check the currently available data in HDFS directory hdfs dfs -Is Step 5 : Import Single table (Without specifying directory). sqoop import -connect jdbc:mysql://quickstart:3306/retail_db -username=retail_dba - password=cloudera -table=categories 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 6 : Read the data from one of the partition, created using above command, hdfs dfs - catxategories/part-m-00000 Step 7 : Specifying target directory in import command (We are using number of mappers =1, you can change accordingly) sqoop import -connect jdbc:mysql://quickstart:3306/retail_db -username=retail_dba -password=cloudera ~table=categories -target-dir=categortes_target -m 1 Step 8 : Check the content in one of the partition file. hdfs dfs -cat categories_target/part-m-00000 Step 9 : Specifying parent directory so that you can copy more than one table in a specified target directory. Command to specify warehouse directory. sqoop import -.-connect jdbc:mysql://quickstart:3306/retail_db -username=retail dba - password=cloudera -table=categories -warehouse-dir=categories_warehouse -m 1
Question # 4
Problem Scenario 62 : You have been given below code snippet.val a = sc.parallelize(List("dogM, "tiger", "lion", "cat", "panther", "eagle"), 2) val b = a.map(x => (x.length, x)) operation1 Write a correct code snippet for operationl which will produce desired output, shown below. Array[(lnt, String)] = Array((3,xdogx), (5,xtigerx), (4,xlionx), (3,xcatx), (7,xpantherx), (5,xeaglex))
|
Answer: See the explanation for Step by Step Solution and configuration. Explanation: Solution : b.mapValuesf'x" + _ + "x").collect mapValues [Pair] : Takes the values of a RDD that consists of two-component tuples, and applies the provided function to transform each value. Tlien,.it.forms newtwo-componend tuples using the key and the transformed value and stores them in a new RDD.
Question # 5
Problem Scenario 39 : You have been given two files spark16/file1.txt 1,9,5 2,7,4 3,8,3 spark16/file2.txt 1,g,h 2,i,j 3,k,l Load these two tiles as Spark RDD and join them to produce the below results (l,((9,5),(g,h))) (2, ((7,4), (i,j))) (3, ((8,3), (k,l))) And write code snippet which will sum the second columns of above joined results (5+4+3). |
Answer: See the explanation for Step by Step Solution and configuration. Explanation: Solution : Step 1 : Create tiles in hdfs using Hue. Step 2 : Create pairRDD for both the files. val one = sc.textFile("spark16/file1.txt").map{ _.split(",",-1) match { case Array(a, b, c) => (a, ( b, c)) } } val two = sc.textFHe(Mspark16/file2.txt").map{ _.split('7\-1) match { case Array(a, b, c) => (a, (b, c)) } } Step 3 : Join both the RDD. val joined = one.join(two) Step 4 : Sum second column values. val sum = joined.map { case (_, ((_, num2), (_, _))) => num2.tolnt }.reduce(_ + _)
Question # 6
Problem Scenario 16 : You have been given following mysql database details as well as other info. user=retail_dba password=cloudera database=retail_db jdbc URL = jdbc:mysql://quickstart:3306/retail_db Please accomplish below assignment. 1. Create a table in hive as below. create table departments_hive(department_id int, department_name string); 2. Now import data from mysql table departments to this hive table. Please make sure that data should be visible using below hive command, select" from departments_hive
|
Answer: See the explanation for Step by Step Solution and configuration. Explanation: Solution : Step 1 : Create hive table as said. hive show tables; create table departments_hive(department_id int, department_name string); Step 2 : The important here is, when we create a table without delimiter fields. Then default delimiter for hive is ^A (\001). Hence, while importing data we have to provide proper delimiter. sqoop import \ -connect jdbc:mysql://quickstart:3306/retail_db \ ~username=retail_dba \ -password=cloudera \ -table departments \ -hive-home /user/hive/warehouse \ -hive-import \ -hive-overwrite \ -hive-table departments_hive \ -fields-terminated-by '\001' Step 3 : Check-the data in directory. hdfs dfs -Is /user/hive/warehouse/departments_hive hdfs dfs -cat/user/hive/warehouse/departmentshive/part' Check data in hive table. Select * from departments_hive;
Question # 7
Problem Scenario 15 : You have been given following mysql database details as well as other info. user=retail_dba password=cloudera database=retail_db jdbc URL = jdbc:mysql://quickstart:3306/retail_db Please accomplish following activities. 1. In mysql departments table please insert following record. Insert into departments values(9999, '"Data Science"1); 2. Now there is a downstream system which will process dumps of this file. However, system is designed the way that it can process only files if fields are enlcosed in(') single quote and separate of the field should be (-} and line needs to be terminated by : (colon). 3. If data itself contains the " (double quote } than it should be escaped by \. 4. Please import the departments table in a directory called departments_enclosedby and file should be able to process by downstream system.
|
Answer: See the explanation for Step by Step Solution and configuration. Explanation: Solution : Step 1 : Connect to mysql database. mysql -user=retail_dba -password=cloudera show databases; use retail_db; show tables; Insert record Insert into departments values(9999, '"Data Science"'); select" from departments; Step 2 : Import data as per requirement. sqoop import \ -connect jdbc:mysql;//quickstart:3306/retail_db \ ~username=retail_dba \ -password=cloudera \ -table departments \ -target-dir /user/cloudera/departments_enclosedby \ -enclosed-by V -escaped-by \\ -fields-terminated-by-' -lines-terminated-by : Step 3 : Check the result. hdfs dfs -cat/user/cloudera/departments_enclosedby/part"
Cloudera cca175 Exam Dumps
5 out of 5
Pass Your CCA Spark and Hadoop Developer Exam Exam in First Attempt With cca175 Exam Dumps. Real CCA Spark and Hadoop Developer Exam Questions As in Actual Exam!
— 96 Questions With Valid Answers
— Updation Date : 15-Apr-2025
— Free cca175 Updates for 90 Days
— 98% CCA Spark and Hadoop Developer Exam Exam Passing Rate
PDF Only Price 49.99$
19.99$
Buy PDF
Speciality
Additional Information
Testimonials
Related Exams
- Number 1 Cloudera CCA Spark and Hadoop Developer study material online
- Regular cca175 dumps updates for free.
- CCA Spark and Hadoop Developer Exam Practice exam questions with their answers and explaination.
- Our commitment to your success continues through your exam with 24/7 support.
- Free cca175 exam dumps updates for 90 days
- 97% more cost effective than traditional training
- CCA Spark and Hadoop Developer Exam Practice test to boost your knowledge
- 100% correct CCA Spark and Hadoop Developer questions answers compiled by senior IT professionals
Cloudera cca175 Braindumps
Realbraindumps.com is providing CCA Spark and Hadoop Developer cca175 braindumps which are accurate and of high-quality verified by the team of experts. The Cloudera cca175 dumps are comprised of CCA Spark and Hadoop Developer Exam questions answers available in printable PDF files and online practice test formats. Our best recommended and an economical package is CCA Spark and Hadoop Developer PDF file + test engine discount package along with 3 months free updates of cca175 exam questions. We have compiled CCA Spark and Hadoop Developer exam dumps question answers pdf file for you so that you can easily prepare for your exam. Our Cloudera braindumps will help you in exam. Obtaining valuable professional Cloudera CCA Spark and Hadoop Developer certifications with cca175 exam questions answers will always be beneficial to IT professionals by enhancing their knowledge and boosting their career.
Yes, really its not as tougher as before. Websites like Realbraindumps.com are playing a significant role to make this possible in this competitive world to pass exams with help of CCA Spark and Hadoop Developer cca175 dumps questions. We are here to encourage your ambition and helping you in all possible ways. Our excellent and incomparable Cloudera CCA Spark and Hadoop Developer Exam exam questions answers study material will help you to get through your certification cca175 exam braindumps in the first attempt.
Pass Exam With Cloudera CCA Spark and Hadoop Developer Dumps. We at Realbraindumps are committed to provide you CCA Spark and Hadoop Developer Exam braindumps questions answers online. We recommend you to prepare from our study material and boost your knowledge. You can also get discount on our Cloudera cca175 dumps. Just talk with our support representatives and ask for special discount on CCA Spark and Hadoop Developer exam braindumps. We have latest cca175 exam dumps having all Cloudera CCA Spark and Hadoop Developer Exam dumps questions written to the highest standards of technical accuracy and can be instantly downloaded and accessed by the candidates when once purchased. Practicing Online CCA Spark and Hadoop Developer cca175 braindumps will help you to get wholly prepared and familiar with the real exam condition. Free CCA Spark and Hadoop Developer exam braindumps demos are available for your satisfaction before purchase order.
Send us mail if you want to check Cloudera cca175 CCA Spark and Hadoop Developer Exam DEMO before your purchase and our support team will send you in email.
If you don't find your dumps here then you can request what you need and we shall provide it to you.
Bulk Packages
$50
- Get 3 Exams PDF
- Get $33 Discount
- Mention Exam Codes in Payment Description.
Buy 3 Exams PDF
$70
- Get 5 Exams PDF
- Get $65 Discount
- Mention Exam Codes in Payment Description.
Buy 5 Exams PDF
$100
- Get 5 Exams PDF + Test Engine
- Get $105 Discount
- Mention Exam Codes in Payment Description.
Buy 5 Exams PDF + Engine
 Jessica Doe
CCA Spark and Hadoop Developer
We are providing Cloudera cca175 Braindumps with practice exam question answers. These will help you to prepare your CCA Spark and Hadoop Developer Exam exam. Buy CCA Spark and Hadoop Developer cca175 dumps and boost your knowledge.
|