spark-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From yhuai <...@git.apache.org>
Subject [GitHub] spark pull request: [SPARK-5658][SQL] Finalize DDL and write suppo...
Date Tue, 10 Feb 2015 23:46:50 GMT
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Mime
View raw message