Home » Apache Spark Count Function

Apache Spark Count Function

by Online Tutorials Library

Spark Count Function

In Spark, the Count function returns the number of elements present in the dataset.

Example of Count function

In this example, we count the number of elements exist in the dataset.

  • Create an RDD using parallelized collection.
  • Now, we can read the generated result by using the following command.

Spark Count Function

  • Apply count() function to count number of elements.

Spark Count Function

Here, we got the desired output.


You may also like