Explain the lookup() operation

Viewing 1 reply thread
  • Author
    Posts
    • #5059
      DataFlair Team
      Moderator

      Explain the lookup() operation

    • #5060
      DataFlair Team
      Moderator

       

      > It is an action
      > It returns the list of values in the RDD for key ‘key’


      val rdd1 = sc.parallelize(Seq(("Spark",78),("Hive",95),("spark",15),("HBase",25),("spark",39),("BigData",78),("spark",49)))
      rdd1.lookup("spark")
      rdd1.lookup("Hive")
      rdd1.lookup("BigData")


      Output:
      Seq[Int] = WrappedArray(15, 39, 49)
      Seq[Int] = WrappedArray(95)
      Seq[Int] = WrappedArray(78)

Viewing 1 reply thread
  • You must be logged in to reply to this topic.