Hi Eduardo,

You can do arbitrary stuff with the data in a DStream using the operation
foreachRDD.

yourDStream.foreachRDD(rdd => {

   // Get and print first n elements
   val firstN = rdd.take(n)
   println("First N elements = " + firstN)

  // Count the number of elements in each batch
  println("RDD has " + rdd.count() + " elements")

})


Alternatively, just for printing the counts, you can also do

yourDStream.count.print()

Hope this helps!

TD



2014/1/20 Eduardo Costa Alfaia <e.costaalf...@studenti.unibs.it>

> Hi guys,
>
> Somebody help me, Where do I get change the print() function to print more
> than 10 lines in screen? Is there a manner to print the count total of all
> words in a batch?
>
> Best Regards
> --
> ---
> INFORMATIVA SUL TRATTAMENTO DEI DATI PERSONALI
>
> I dati utilizzati per l'invio del presente messaggio sono trattati
> dall'Università degli Studi di Brescia esclusivamente per finalità
> istituzionali. Informazioni più dettagliate anche in ordine ai diritti
> dell'interessato sono riposte nell'informativa generale e nelle notizie
> pubblicate sul sito web dell'Ateneo nella sezione "Privacy".
>
> Il contenuto di questo messaggio è rivolto unicamente alle persona cui
> è indirizzato e può contenere informazioni la cui riservatezza è
> tutelata legalmente. Ne sono vietati la riproduzione, la diffusione e l'uso
> in mancanza di autorizzazione del destinatario. Qualora il messaggio
> fosse pervenuto per errore, preghiamo di eliminarlo.
>

Reply via email to