How to count the values which are repeating in an array using RDD,dataframe,dataset in scala

Keywords: scala apache-spark apache-spark-sql rdd apache-spark-dataset

Question: 

I have to count the repeating values in an array

val arr = Array[1,2,2,3,4,5,5,5]

For example how to count the number of 5's in the array using RDD,Dataframe,Datasets?

Answers: