Q. 為什么我們應該使用快取,因為我們有持久化,它只有記憶體和其他選項?
這個問題是在面試中問我的,我對此一無所知,請幫助我理解。
uj5u.com熱心網友回復:
cachepersist與默認存盤級別相同:
從Scala 代碼:
/**
* Persist this Dataset with the default storage level (`MEMORY_AND_DISK`).
*
* @group basic
* @since 1.6.0
*/
def cache(): this.type = persist()
所以cache可以看作是一個被廣泛使用的便利函式。
uj5u.com熱心網友回復:
另外值得注意的是,RDD 的默認存盤級別是MEMORY_ONLY,因此cache()一般來說,在他們的情況下的行為與 Dataset 不同。
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/511158.html
