[英]What is the difference between DataFrame.cache() and hiveContext.cacheTable?
以下代碼段之間是否有任何區別:
val df = hiveContext.createDataFrame(rows, schema)
df.registerTempTable("myTable")
df.cache()
和
val df = hiveContext.createDataFrame(rows, schema)
df.registerTempTable("myTable")
hiveContext.cacheTable("myTable")
沒有區別。 HiveContext類擴展了SQLContext類(源代碼) ,因此它們共享相同的cacheManager
。 實際上,HiveContext根本沒有cacheTable
函數(它調用SQLContext的cacheTable
函數)
編輯 :調用df.cache()
轉換為調用persist
,這將轉換為sqlContext.cacheManager.cacheQuery(this)
,如DataFrame的源代碼所示
而sqlContext.cacheTable
也轉換為sqlContext.cacheManager.cacheQuery
源代碼
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.