我想更准确地了解在pyspark中使用方法缓存for dataframe
当我运行df.cache()它时返回一个数据帧.因此,如果我这样做df2 = df.cache(),哪个数据帧在缓存中?难道df,df2或两者兼而有之?
Ste*_*ven 13
我找到了源代码https://spark.apache.org/docs/1.1.1/api/python/pyspark.rdd-pysrc.html#RDD.cache
def cache(self):
"""
Persist this RDD with the default storage level (C{MEMORY_ONLY_SER}).
"""
self.is_cached = True
self.persist(StorageLevel.MEMORY_ONLY_SER)
return self
Run Code Online (Sandbox Code Playgroud)
因此,答案是:两者兼而有之