Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- x=sc.textFile("/home/amel/1MB").filter(!_.contains("NULL"))
- .filter(!_.contains("Null"))
- val re = x.map(row => {
- val cols = row.split(",")
- val Cycle = cols(2)
- val Duration = Cycle match {
- case "Licence" => "3 years"
- case "Master" => "2 years"
- case "Ingéniorat" => "5 years"
- case "Ingeniorat" => "5 years"
- case "Doctorat" => "3 years"
- case _ => "NULL"
- }
- (cols(1).split("-")(0) + "," + Cycle + "," + Duration + "," +
- cols(3), 1)
- }).reduceByKey(_ + _)
- re.collect.foreach(println)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement