Github user rxin commented on a diff in the pull request:
https://github.com/apache/spark/pull/13780#discussion_r67832007
--- Diff: python/pyspark/sql/dataframe.py ---
@@ -376,24 +376,47 @@ def foreachPartition(self, f):
@since(1.3)
def cache(self):
- """ Persists with the default storage level (C{MEMORY_ONLY}).
+ """Persists the :class:`DataFrame` with the default storage level
(C{MEMORY_AND_DISK}).
+
+ .. note:: the default storage level has changed to
C{MEMORY_AND_DISK} to match Scala in 2.0.
"""
self.is_cached = True
self._jdf.cache()
return self
@since(1.3)
- def persist(self, storageLevel=StorageLevel.MEMORY_ONLY):
- """Sets the storage level to persist its values across operations
- after the first time it is computed. This can only be used to
assign
- a new storage level if the RDD does not have a storage level set
yet.
- If no storage level is specified defaults to (C{MEMORY_ONLY}).
+ def persist(self, storageLevel=StorageLevel.MEMORY_AND_DISK):
+ """Sets the storage level to persist the contents of the
:class:`DataFrame` across
+ operations after the first time it is computed. This can only be
used to assign
+ a new storage level if the :class:`DataFrame` does not have a
storage level set yet.
+ If no storage level is specified defaults to (C{MEMORY_AND_DISK}).
+
+ .. note:: the default storage level has changed to
C{MEMORY_AND_DISK} to match Scala in 2.0.
"""
self.is_cached = True
javaStorageLevel = self._sc._getJavaStorageLevel(storageLevel)
self._jdf.persist(javaStorageLevel)
return self
+ @since(2.0)
+ def storageLevel(self):
--- End diff --
maybe mark this as a property so we don't need to use parenthesis?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]