Github user yhuai commented on a diff in the pull request:
https://github.com/apache/spark/pull/4446#discussion_r24462846
--- Diff: python/pyspark/sql/dataframe.py ---
@@ -146,9 +146,74 @@ def insertInto(self, tableName, overwrite=False):
"""
self._jdf.insertInto(tableName, overwrite)
- def saveAsTable(self, tableName):
- """Creates a new table with the contents of this DataFrame."""
- self._jdf.saveAsTable(tableName)
+ def _java_save_mode(self, mode):
+ """Returns the Java save mode based on the Python save mode
represented by a string.
+ """
+ jmode =
self._sc._jvm.org.apache.spark.sql.sources.SaveMode.ErrorIfExists
+ mode = mode.lower()
+ if mode == "append":
+ jmode =
self._sc._jvm.org.apache.spark.sql.sources.SaveMode.Append
+ elif mode == "overwrite":
+ jmode =
self._sc._jvm.org.apache.spark.sql.sources.SaveMode.Overwrite
+ elif mode == "ignore":
+ jmode =
self._sc._jvm.org.apache.spark.sql.sources.SaveMode.Ignore
+ elif mode == "error":
+ pass
+ else:
+ raise ValueError(
+ "Only 'append', 'overwrite', 'ignore', and 'error' are
acceptable save mode.")
+ return jmode
+
+ def saveAsTable(self, tableName, source=None, mode="append",
**options):
--- End diff --
I am not sure if we can do it. `tableName` has been used at lots of places.
---
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]