简体   繁体   中英

In spark streaming, what is the difference between foreach and foreachRDD

For example, how would

x.foreach(rdd => rdd.cache())

be different from

x.foreachRDD(rdd => rdd.cache())

Note that x is a DStream here.

There is no difference in work, foreach() uses foreachRDD. foreach() was deprecated and in Spark 2.0 this function is removed

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