Repository: spark
Updated Branches:
  refs/heads/master 7f99a05e6 -> aa88b8dbb


[SPARK-22490][DOC] Add PySpark doc for SparkSession.builder

## What changes were proposed in this pull request?

In PySpark API Document, 
[SparkSession.build](http://spark.apache.org/docs/2.2.0/api/python/pyspark.sql.html)
 is not documented and shows default value description.
```
SparkSession.builder = <pyspark.sql.session.Builder object ...
```

This PR adds the doc.

![screen](https://user-images.githubusercontent.com/9700541/32705514-1bdcafaa-c7ca-11e7-88bf-05566fea42de.png)

The following is the diff of the generated result.

```
$ diff old.html new.html
95a96,101
> <dl class="attribute">
> <dt id="pyspark.sql.SparkSession.builder">
> <code class="descname">builder</code><a class="headerlink" 
> href="#pyspark.sql.SparkSession.builder" title="Permalink to this 
> definition">¶</a></dt>
> <dd><p>A class attribute having a <a class="reference internal" 
> href="#pyspark.sql.SparkSession.Builder" 
> title="pyspark.sql.SparkSession.Builder"><code class="xref py py-class 
> docutils literal"><span class="pre">Builder</span></code></a> to construct <a 
> class="reference internal" href="#pyspark.sql.SparkSession" 
> title="pyspark.sql.SparkSession"><code class="xref py py-class docutils 
> literal"><span class="pre">SparkSession</span></code></a> instances</p>
> </dd></dl>
>
212,216d217
< <dt id="pyspark.sql.SparkSession.builder">
< <code class="descname">builder</code><em class="property"> = 
&lt;pyspark.sql.session.SparkSession.Builder object&gt;</em><a 
class="headerlink" href="#pyspark.sql.SparkSession.builder" title="Permalink to 
this definition">¶</a></dt>
< <dd></dd></dl>
<
< <dl class="attribute">
```

## How was this patch tested?

Manual.

```
cd python/docs
make html
open _build/html/pyspark.sql.html
```

Author: Dongjoon Hyun <dongj...@apache.org>

Closes #19726 from dongjoon-hyun/SPARK-22490.


Project: http://git-wip-us.apache.org/repos/asf/spark/repo
Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/aa88b8db
Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/aa88b8db
Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/aa88b8db

Branch: refs/heads/master
Commit: aa88b8dbbb7e71b282f31ae775140c783e83b4d6
Parents: 7f99a05
Author: Dongjoon Hyun <dongj...@apache.org>
Authored: Wed Nov 15 08:59:29 2017 -0800
Committer: gatorsmile <gatorsm...@gmail.com>
Committed: Wed Nov 15 08:59:29 2017 -0800

----------------------------------------------------------------------
 python/docs/pyspark.sql.rst   | 3 +++
 python/pyspark/sql/session.py | 4 ++++
 2 files changed, 7 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/spark/blob/aa88b8db/python/docs/pyspark.sql.rst
----------------------------------------------------------------------
diff --git a/python/docs/pyspark.sql.rst b/python/docs/pyspark.sql.rst
index 09848b8..5c3b7e2 100644
--- a/python/docs/pyspark.sql.rst
+++ b/python/docs/pyspark.sql.rst
@@ -7,6 +7,9 @@ Module Context
 .. automodule:: pyspark.sql
     :members:
     :undoc-members:
+    :exclude-members: builder
+.. We need `exclude-members` to prevent default description generations
+   as a workaround for old Sphinx (< 1.6.6).
 
 pyspark.sql.types module
 ------------------------

http://git-wip-us.apache.org/repos/asf/spark/blob/aa88b8db/python/pyspark/sql/session.py
----------------------------------------------------------------------
diff --git a/python/pyspark/sql/session.py b/python/pyspark/sql/session.py
index dbbcfff..47c58bb 100644
--- a/python/pyspark/sql/session.py
+++ b/python/pyspark/sql/session.py
@@ -72,6 +72,9 @@ class SparkSession(object):
     ...     .appName("Word Count") \\
     ...     .config("spark.some.config.option", "some-value") \\
     ...     .getOrCreate()
+
+    .. autoattribute:: builder
+       :annotation:
     """
 
     class Builder(object):
@@ -183,6 +186,7 @@ class SparkSession(object):
                 return session
 
     builder = Builder()
+    """A class attribute having a :class:`Builder` to construct 
:class:`SparkSession` instances"""
 
     _instantiatedSession = None
 


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@spark.apache.org
For additional commands, e-mail: commits-h...@spark.apache.org

Reply via email to