...

Cloud Computing - spark

Back to Course

Lesson Description


Lession - #782 First Function


Spark First Function

In Spark, the First capacity generally returns the main component of the dataset. It is like take(1>
.

Example of First function
  • In this example, we retrieve the first element of the dataset.

To open the Spark in Scala mode, follow the below command.
$ spark-shell



  • Make a RDD utilizing the parallelized assortment.

scala> val information = sc.parallelize(List(10,20,30,40,50>
>

  • Presently, we can peruse the created outcome by utilizing the accompanying order.

scala> data.collect



  • Apply first(>
    capacity to recover the principal component of the dataset.

scala> val firstfunc = data.first(>