DStream to Rdd in Spark-Straming

128 views Asked by At

I have a DStream[String,String] and I need to convert it to RDD[String,String]. Is there any way to do it? I need to do using Scala language.

Thanks in advance!!

1

There are 1 answers

0
Emiliano Martinez On BEST ANSWER

A DStream is a discretized sequence of RDDs. Take a look to the direct stream API.

Having your DStream,with the forEach function you can apply transformations for each RDD:

val yourStream: DStream[String] = //...

yourStream.forEachRDD{ rdd =>
   // your rdd transformations...
}

You can take a look to examples here