action count() in Spark RDD

Viewing 1 reply thread
  • Author
    Posts
    • #5029
      DataFlair TeamDataFlair Team
      Spectator

      Explain the action count() in Spark RDD.

    • #5032
      DataFlair TeamDataFlair Team
      Spectator

      <div class=”post”>

        <li style=”list-style-type: none”>


      Example: 

      val rdd1 = sc.parallelize(List(10,20,30,40))
      println(rdd1.count())

      Output:
      4

      It returns a number of elements or items in RDD. So it basically counts the number of items present in the dataset and returns a number after the count.

      </div>

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