What is the output of the following code [closed]

0 votes
What is the output of the following code?
sc.parallelize(Array(1L,("SFO")),(2L,("ORD")),(3L,("DFW"))))
val routes = sc.parallelize
Array(Edge(1L,2L,1800),Edge(2L,3L,800),Edge(3L,1L,1400)))
val nowhere = "nowhere"
val graph =Graph(airports,routes,nowhere)
graph.triplet.sortBy( ,attr, ascending=false).map(triplet=>
triplet.attr.toString + " " + triplet.scrAttr+" " +
triplet.dstAttr).collect.foreach(println)

a) 1800 ORD SFO
1400 DFW SFO
800 DFW ORD

B) 800 ORD SFO
1400 DFW SFO
1800 DFW ORD

C) 1800 DFW ORD
1400 DFW SFO
800 ORD SFO
Nov 25, 2020 in Apache Spark by Edureka
• 200 points

closed Nov 26, 2020 by MD 623 views

Related Questions In Apache Spark

0 votes
1 answer

What is the output of the following code?

After executing your code, there is an ...READ MORE

answered Nov 25, 2020 in Apache Spark by Gitika
• 65,910 points
767 views
0 votes
1 answer

What is the output of the following code?

rror: expected class or object definition sc.parallelize(Array(1L,("SFO")),(2L,("ORD")),(3L,("DFW")))) ^ one error ...READ MORE

answered Nov 26, 2020 in Apache Spark by Gitika
• 65,910 points
677 views
0 votes
1 answer

What is the advantage of having immutability in design for Scala programming language?

Hi, Scala uses immutability by default in most ...READ MORE

answered Jul 24, 2019 in Apache Spark by Gitika
• 65,910 points
548 views
–1 vote
0 answers
0 votes
1 answer

What is the work of Yield Keyword in Scala?

Hey, Used with a loop, yield produces a value for ...READ MORE

answered Jul 26, 2019 in Apache Spark by Gitika
• 65,910 points
589 views
0 votes
1 answer

What is the use of App class in Scala?

Hi, Scala provides a helper class, called App, that ...READ MORE

answered Jul 31, 2019 in Apache Spark by Gitika
• 65,910 points
10,786 views
+1 vote
0 answers

What is the use case of map and flatMap?

What is the major use case for ...READ MORE

Aug 25, 2019 in Apache Spark by anonymous
• 130 points

closed Aug 26, 2019 by Omkar 1,430 views
0 votes
1 answer
0 votes
1 answer

2)What will be printed when the below code is executed ?

Hi, @Ritu, List(5,100,10) is printed. The take method returns the first n elements in ...READ MORE

answered Nov 23, 2020 in Apache Spark by Gitika
• 65,910 points
586 views
0 votes
1 answer
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP