Free Online Certification Courses – Learn Today. Lead Tomorrow. › Forums › Apache Spark › Explain values() operation in Apache Spark. This topic has 2 replies, 1 voice, and was last updated 5 years, 6 months ago by DataFlair Team. Viewing 2 reply threads Author Posts September 20, 2018 at 2:38 pm #5233 DataFlair TeamSpectator Explain values() operation in Apache Spark. September 20, 2018 at 2:39 pm #5236 DataFlair TeamSpectator values() is a transformation. It returns an RDD of values only. <br /> val rdd1 = sc.parallelize(Seq((2,4),(3,6),(4,8),(5,10),(6,12),(7,14),(8,16),(9,18),(10,20)))<br /> val rdd2 = rdd1.values<br /> rdd2.collect<br /> Output: Array[Int] = Array(4, 6, 8, 10, 12, 14, 16, 18, 20) September 20, 2018 at 2:39 pm #5239 DataFlair TeamSpectator > Example2 : Values are duplicate in data set <br /> val rdd1 = sc.parallelize(Seq((2,4),(3,6),(4,8),(2,6),(4,12),(5,10),(5,40),(10,40)))<br /> val rdd2 = rdd1.keys<br /> rdd2.collect<br /> val rdd3 = rdd1.values<br /> rdd3.collect<br /> Output: Array[Int] = Array(2, 3, 4, 2, 4, 5, 5, 10) Array[Int] = Array(4, 6, 8, 6, 12, 10, 40, 40 Author Posts Viewing 2 reply threads You must be logged in to reply to this topic. Log In Username: Password: Keep me signed in Signup / Login with Google Log In