Skip to content

pysparky_config.composition

Deterministic composition for string-valued Spark configuration maps.

Functions

NameDescription
compose_spark_configsCompose Spark config maps with explicit scalar conflict handling.

compose_spark_configsfunction#

def compose_spark_configs(*configs: Mapping[str, str], overrides: Mapping[str, str] | None = None) -> dict[str, str]

Compose Spark config maps with explicit scalar conflict handling.

Equal scalar values are kept once. Different scalar values raise ValueError unless the key appears in overrides. spark.jars.packages and spark.sql.extensions are merged as comma-separated lists in first-seen order, with exact duplicate entries removed. Package coordinates that name the same group and artifact at different versions raise ValueError.

The input mappings are not modified. Keys keep their first-seen order; an explicit override changes a value without moving its key. The function uses only the standard library and does not validate runtime compatibility or initialize Spark.

Raises

TypeError
If an input or override is not a string-to-string mapping.
ValueError
If a scalar conflict is unresolved, a list entry is malformed, a package coordinate is incompatible, or an override targets a list setting or unknown key.