Consider sales dataset with column names as CustomerID, Location, Merchant, Amount. Requirement is to create a paired RDD with CustomerID as key and Amount as value. Which of the below code snippet is correct to create a paired RDD.

val SalesData = sc.textFile("HDFS Path") 

val PairedSalesData = SalesData.map{record => (record.split(",")(0),record.split(",")(3).toLong)}

val SalesData = sc.textFile("HDFS Path") 

val PairedSalesData = SalesData.flatMap{record => (record.split(",")(1),record.split(",")(4).toLong)}

val SalesData = sc.textFile("HDFS Path")

val PairedSalesData = SalesData.reduce{record => (record.split(",")(0),record.split(",")(3).toLong)}

val SalesData = sc.textFile("HDFS Path")

val PairedSalesData = SalesData.filter{record => (record.split(",")(0),record.split(",")(3).toLong)}

Verified Answer
Correct Option - a

To get all Infosys Certified Spark Professional Exam questions Join Group https://bit.ly/infy_premium_group

We're passionate about offering best placement materials and courses!! A one stop place for Placement Materials. We daily post Offcampus updates and Placement Materials.

Qtr No. 213, New Town Yehlanka Indore 454775

admin@prepflix.in