Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
在 SparkR 我有一个 DataFrameu包含
u
'amount' = 231,2,324,1213 ...
要计算 sparkR 的总和,我使用
summa <- agg(u, amount="sum")
现在summa是一个DataFrame。我想知道 的值,summa我可以通过键入head(summa)或来获得该值,collect(summa)但这大约需要 2 分钟。我怎样才能更快地获得价值?或者我如何使用summa整数。
summa
head(summa)
collect(summa)
我认为head(summa)缓慢的原因不是因为head功能,而是因为惰性评估在起作用。也就是说,在调用函数之前,我们不计算summa(因此使用agg) 。当你打电话时,你也会得到 call 的开销。headheadagg
head
agg