中的值 hllTotal
更新了,但是 hllToday
每把钥匙都保持零。
有人能帮忙吗,为什么 hllToday
这里没有更新吗?
val hllToday: HllSerializable = new HllSerializable(new HLL(13, 5))
val hllTotal: HllSerializable = new HllSerializable(new HLL(13, 5))
val initialSet = (hllToday, hllTotal)
val rdd7 = combinedRdd.map(tuple => {
tuple.segmentId -> (tuple.entryTime, tuple.exitTime, tuple.hll)`
}).aggregateByKey(initialSet)(
(acc: (HllSerializable, HllSerializable), v: (Long, Long, HllSerializable)) => {
if (v._1 == today_ts) {
acc._1.getHll.union(v._3.getHll)
}
acc._2.getHll.union(v._3.getHll)
acc
}, (acc1: (HllSerializable, HllSerializable), acc2: (HllSerializable, HllSerializable)) => {
acc1._1.getHll.union(acc2._1.getHll)
acc1._2.getHll.union(acc2._2.getHll)
acc1
}
)
1条答案
按热度按时间jk9hmnmh1#
显然,这个代码从未被调用:
尝试替换
if (v._1 == today_ts)
与if(true)
看看hllToday
更新