简体   繁体   中英

DStream to Rdd in Spark-Straming

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!!

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM