我正在尝试在Spark Streaming框架中实现一个与PageRank相似的算法。
不幸的是,我发现当我多次写mapWithState时:
val mappedWithState = wordCounts
.mapWithState[Long, (String, Long)](spec)
.mapWithState[Long, (String, Long)](spec)
.mapWithState[Long, (String, Long)](spec)
每个mapWithState都创建并使用自己的状态。
是否可以在单批次中多次使用和更新同一状态?我知道存在StreamContext.remember(someDuration)方法,但它看起来非常昂贵。