What is the output of the following code

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

D)Run time error
Nov 25, 2020 in Apache Spark by ritu
• 960 points
885 views

1 answer to this question.

0 votes
rror: expected class or object definition
sc.parallelize(Array(1L,("SFO")),(2L,("ORD")),(3L,("DFW"))))
^
one error found
Option D
answered Nov 26, 2020 by Gitika
• 65,770 points

Related Questions In Apache Spark

0 votes
0 answers

What is the output of the following code?

What is the output of the following ...READ MORE

Nov 25, 2020 in Apache Spark by Edureka
• 200 points

closed Nov 26, 2020 by MD 775 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,770 points
933 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,770 points
11,376 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,660 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,770 points
774 views
0 votes
1 answer
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,770 points
953 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,770 points
759 views
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