...

Cloud Computing - spark

Back to Course

Lesson Description


Lession - #783 Take Function


Spark Take Function

In Spark, the take work acts like an exhibit. It gets a number worth (let say, n>
as a boundary and returns a variety of first n components of the dataset.

Example of Take function
  • In this model, we return the principal n components of a current dataset.

To open the Spark in Scala mode, follow the beneath order.
$ flash 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 take(>
    function to return an array of elements.

      scala> val takefunc = data.take(3>