config (SparkSession.Builder)

Anger ett konfigurationsalternativ. Alternativ som ställs in med denna metod propagerar automatiskt till både SparkConf och SparkSessions egen konfiguration.

Syntax

config(key=None, value=None, conf=None, *, map=None)

Parameters

Parameter Type Description
key str, valfritt En nyckelnamnsträng för en konfigurationsegenskap.
value str, valfritt Ett värde för konfigurationsegenskapen.
conf SparkConf, valfritt En instans av SparkConf.
map diktering, valfritt En ordbok över konfigurationer att sätta.

Returns

SparkSession.Builder

Examples

# For an existing SparkConf, use the conf parameter.
from pyspark.conf import SparkConf
conf = SparkConf().setAppName("example").setMaster("local")
SparkSession.builder.config(conf=conf)

# For a (key, value) pair, you can omit the parameter names.
SparkSession.builder.config("spark.some.config.option", "some-value")

# Set multiple configurations.
SparkSession.builder.config(
    "spark.some.config.number", 123).config("spark.some.config.float", 0.123)

# Set multiple configurations using a dictionary.
SparkSession.builder.config(
    map={"spark.some.config.number": 123, "spark.some.config.float": 0.123})