Skip to content

Commit

Permalink
[SPARK-45773][PYTHON][DOCS] Refine docstring of SparkSession.builder.…
Browse files Browse the repository at this point in the history
…config

### What changes were proposed in this pull request?

This PR refines the docstring of the method `SparkSession.builder.config`.

### Why are the changes needed?

To improve PySpark documentation.

### Does this PR introduce _any_ user-facing change?

No

### How was this patch tested?

doc test

### Was this patch authored or co-authored using generative AI tooling?

No

Closes #43639 from allisonwang-db/spark-45773-config.

Authored-by: allisonwang-db <allison.wang@databricks.com>
Signed-off-by: Hyukjin Kwon <gurwls223@apache.org>
  • Loading branch information
allisonwang-db authored and HyukjinKwon committed Nov 6, 2023
1 parent f603830 commit 82ffd25
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions python/pyspark/sql/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,20 +253,31 @@ def config(
-------
:class:`SparkSession.Builder`
See Also
--------
:class:`SparkConf`
Examples
--------
For an existing class:`SparkConf`, use `conf` parameter.
For an existing :class:`SparkConf`, use `conf` parameter.
>>> from pyspark.conf import SparkConf
>>> SparkSession.builder.config(conf=SparkConf())
>>> conf = SparkConf().setAppName("example").setMaster("local")
>>> SparkSession.builder.config(conf=conf)
<pyspark.sql.session.SparkSession.Builder...
For a (key, value) pair, you can omit parameter names.
>>> SparkSession.builder.config("spark.some.config.option", "some-value")
<pyspark.sql.session.SparkSession.Builder...
Additionally, you can pass a dictionary of configurations to set.
Set multiple configurations.
>>> SparkSession.builder.config(
... "spark.some.config.number", 123).config("spark.some.config.float", 0.123)
<pyspark.sql.session.SparkSession.Builder...
Set multiple configurations using a dictionary.
>>> SparkSession.builder.config(
... map={"spark.some.config.number": 123, "spark.some.config.float": 0.123})
Expand Down

0 comments on commit 82ffd25

Please sign in to comment.