You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spark.apache.org by gu...@apache.org on 2021/07/19 10:52:04 UTC
[spark] branch branch-3.2 updated: [SPARK-36181][PYTHON] Update
pyspark sql readwriter documentation
This is an automated email from the ASF dual-hosted git repository.
gurwls223 pushed a commit to branch branch-3.2
in repository https://gitbox.apache.org/repos/asf/spark.git
The following commit(s) were added to refs/heads/branch-3.2 by this push:
new b80ceb55 [SPARK-36181][PYTHON] Update pyspark sql readwriter documentation
b80ceb55 is described below
commit b80ceb552dbbd184b74f324e9413ed84289ff27c
Author: Dominik Gehl <do...@open.ch>
AuthorDate: Mon Jul 19 19:50:42 2021 +0900
[SPARK-36181][PYTHON] Update pyspark sql readwriter documentation
### What changes were proposed in this pull request?
Updating the pyspark sql readwriter documentation to the level of detail provided by the scala documentation
### Why are the changes needed?
documentation clarity
### Does this PR introduce _any_ user-facing change?
No
### How was this patch tested?
Only documentation change
Closes #33394 from dominikgehl/feature/SPARK-36181.
Authored-by: Dominik Gehl <do...@open.ch>
Signed-off-by: Hyukjin Kwon <gu...@apache.org>
(cherry picked from commit 2ef8ced27a6b0170a691722a855d3886e079f037)
Signed-off-by: Hyukjin Kwon <gu...@apache.org>
---
python/pyspark/sql/readwriter.py | 24 +++++++++++++++++++++---
1 file changed, 21 insertions(+), 3 deletions(-)
diff --git a/python/pyspark/sql/readwriter.py b/python/pyspark/sql/readwriter.py
index fa3e829..0ef59c0 100644
--- a/python/pyspark/sql/readwriter.py
+++ b/python/pyspark/sql/readwriter.py
@@ -623,8 +623,9 @@ class DataFrameWriter(OptionUtils):
return self
def bucketBy(self, numBuckets, col, *cols):
- """Buckets the output by the given columns.If specified,
- the output is laid out on the file system similar to Hive's bucketing scheme.
+ """Buckets the output by the given columns. If specified,
+ the output is laid out on the file system similar to Hive's bucketing scheme,
+ but with a different bucket hash function and is not compatible with Hive's bucketing.
.. versionadded:: 2.3.0
@@ -745,7 +746,16 @@ class DataFrameWriter(OptionUtils):
It requires that the schema of the :class:`DataFrame` is the same as the
schema of the table.
- Optionally overwriting any existing data.
+ Parameters
+ ----------
+ overwrite : bool, optional
+ If true, overwrites existing data. Disabled by default
+
+ Notes
+ -----
+ Unlike :meth:`DataFrameWriter.saveAsTable`, :meth:`DataFrameWriter.insertInto` ignores
+ the column names and just uses position-based resolution.
+
"""
if overwrite is not None:
self.mode("overwrite" if overwrite else "append")
@@ -766,6 +776,14 @@ class DataFrameWriter(OptionUtils):
.. versionadded:: 1.4.0
+ Notes
+ -----
+ When `mode` is `Append`, if there is an existing table, we will use the format and
+ options of the existing table. The column order in the schema of the :class:`DataFrame`
+ doesn't need to be same as that of the existing table. Unlike
+ :meth:`DataFrameWriter.insertInto`, :meth:`DataFrameWriter.saveAsTable` will use the
+ column names to find the correct column positions.
+
Parameters
----------
name : str
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@spark.apache.org
For additional commands, e-mail: commits-help@spark.apache.org