我想更准确地了解pyspark中数据帧的方法缓存的使用
当我跑步时df.cache()
它返回一个数据帧。
因此,如果我这样做df2 = df.cache()
,哪个数据帧在缓存中?是吗df
, df2
, 或两者 ?
我找到了源代码DataFrame.cache https://spark.apache.org/docs/latest/api/python/_modules/pyspark/sql/dataframe.html#DataFrame.cache
def cache(self):
"""Persists the :class:`DataFrame` with the default storage level (`MEMORY_AND_DISK`).
.. note:: The default storage level has changed to `MEMORY_AND_DISK` to match Scala in 2.0.
"""
self.is_cached = True
self._jdf.cache()
return self
因此,答案是:both
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)