Repository: spark Updated Branches: refs/heads/branch-2.2 210f2922b -> 3cefddee5
[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"> = <pyspark.sql.session.SparkSession.Builder object></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. (cherry picked from commit aa88b8dbbb7e71b282f31ae775140c783e83b4d6) Signed-off-by: gatorsmile <gatorsm...@gmail.com> Project: http://git-wip-us.apache.org/repos/asf/spark/repo Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/3cefddee Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/3cefddee Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/3cefddee Branch: refs/heads/branch-2.2 Commit: 3cefddee5cc4e497d750b6394cb4bb6f7e524dbd Parents: 210f2922 Author: Dongjoon Hyun <dongj...@apache.org> Authored: Wed Nov 15 08:59:29 2017 -0800 Committer: gatorsmile <gatorsm...@gmail.com> Committed: Wed Nov 15 09:00:39 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/3cefddee/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/3cefddee/python/pyspark/sql/session.py ---------------------------------------------------------------------- diff --git a/python/pyspark/sql/session.py b/python/pyspark/sql/session.py index 4d14ae0..d661b5d 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