Skip to content

Commit

Permalink
Doc format.
Browse files Browse the repository at this point in the history
  • Loading branch information
yhuai committed Feb 10, 2015
1 parent 92b6659 commit 609129c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 14 deletions.
8 changes: 4 additions & 4 deletions python/pyspark/sql/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -471,8 +471,8 @@ def func(iterator):
def load(self, path=None, source=None, schema=None, **options):
"""Returns the dataset in a data source as a DataFrame.
The data source is specified by the ``source`` and a set of ``options``.
If ``source`` is not specified, the default data source configured by
The data source is specified by the `source` and a set of `options`.
If `source` is not specified, the default data source configured by
spark.sql.sources.default will be used.
Optionally, a schema can be provided as the schema of the returned DataFrame.
Expand All @@ -499,8 +499,8 @@ def createExternalTable(self, tableName, path=None, source=None,
It returns the DataFrame associated with the external table.
The data source is specified by the ``source`` and a set of ``options``.
If ``source`` is not specified, the default data source configured by
The data source is specified by the `source` and a set of `options`.
If `source` is not specified, the default data source configured by
spark.sql.sources.default will be used.
Optionally, a schema can be provided as the schema of the returned DataFrame and
Expand Down
22 changes: 12 additions & 10 deletions python/pyspark/sql/dataframe.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,18 +167,19 @@ def _java_save_mode(self, mode):
def saveAsTable(self, tableName, source=None, mode="append", **options):
"""Saves the contents of the DataFrame to a data source in a table.
The data source is specified by the ``source`` and a set of ``options``.
If ``source`` is not specified, the default data source configured by
The data source is specified by the `source` and a set of `options`.
If `source` is not specified, the default data source configured by
spark.sql.sources.default will be used.
Additionally, mode is used to specify the behavior of the saveAsTable operation when
table already exists in the data source. There are four modes:
* append: Contents of this DataFrame are expected to be appended to existing table.
* overwrite: Data in the existing table is expected to be overwritten by the contents of
this DataFrame.
* overwrite: Data in the existing table is expected to be overwritten by the contents of \
this DataFrame.
* error: An exception is expected to be thrown.
* ignore: The save operation is expected to not save the contents of the DataFrame and
to not change the existing table.
* ignore: The save operation is expected to not save the contents of the DataFrame and \
to not change the existing table.
"""
if source is None:
source = self.sql_ctx.getConf("spark.sql.sources.default",
Expand All @@ -191,17 +192,18 @@ def saveAsTable(self, tableName, source=None, mode="append", **options):
def save(self, path=None, source=None, mode="append", **options):
"""Saves the contents of the DataFrame to a data source.
The data source is specified by the ``source`` and a set of ``options``.
If ``source`` is not specified, the default data source configured by
The data source is specified by the `source` and a set of `options`.
If `source` is not specified, the default data source configured by
spark.sql.sources.default will be used.
Additionally, mode is used to specify the behavior of the save operation when
data already exists in the data source. There are four modes:
* append: Contents of this DataFrame are expected to be appended to existing data.
* overwrite: Existing data is expected to be overwritten by the contents of this DataFrame.
* error: An exception is expected to be thrown.
* ignore: The save operation is expected to not save the contents of the DataFrame and
to not change the existing data.
* ignore: The save operation is expected to not save the contents of the DataFrame and \
to not change the existing data.
"""
if path is not None:
options["path"] = path
Expand Down

0 comments on commit 609129c

Please sign in to comment.