spark-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rxin <...@git.apache.org>
Subject [GitHub] spark pull request: [SPARK-8021] [SQL] [PYSPARK] make Python read/...
Date Tue, 02 Jun 2015 07:05:38 GMT
Github user rxin commented on a diff in the pull request:

    https://github.com/apache/spark/pull/6578#discussion_r31497064
  
    --- Diff: python/pyspark/sql/readwriter.py ---
    @@ -194,6 +219,48 @@ def __init__(self, df):
             self._sqlContext = df.sql_ctx
             self._jwrite = df._jdf.write()
     
    +    def mode(self, saveMode):
    +        """
    +        Specifies the behavior when data or table already exists. Options include:
    +
    +        * `append`: Append contents of this :class:`DataFrame` to existing data.
    +        * `overwrite`: Overwrite existing data.
    +        * `error`: Throw an exception if data already exists.
    +        * `ignore`: Silently ignore this operation if data already exists.
    +        """
    +        self._jwrite = self._jwrite.mode(saveMode)
    +        return self
    +
    +    @since(1.4)
    +    def format(self, source):
    +        """
    +        Specifies the underlying output data source. Built-in options include
    +        "parquet", "json", etc.
    +        """
    +        self._jwrite = self._jwrite.format(source)
    +        return self
    +
    +    @since(1.4)
    +    def options(self, **options):
    +        """
    +        Adds output options for the underlying data source.
    +        """
    +        for k in options:
    +            self._jwrite = self._jwrite.option(k, options[k])
    +        return self
    +
    +    @since(1.4)
    +    def partitionBy(self, *cols):
    +        """
    +        Partitions the output by the given columns on the file system.
    +        If specified, the output is laid out on the file system similar
    +        to Hive's partitioning scheme.
    +
    +        :param cols: name of columns
    +        """
    +        self._jwrite = self._jwrite.partitionBy(_to_seq(self._sqlContext._sc, cols))
    --- End diff --
    
    would be great to support the 1st argument being a list


---
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