Skip to content

[BUG] %%configure Overwrites Entire session_configs Without Merge #958

Open
@ChaonengQuan

Description

@ChaonengQuan

Describe the bug
The %%configure magic command in SparkMagic completely replaces the session_configs object with the JSON provided in the cell. It does not merge the new configuration with existing settings from ~/.sparkmagic/config.json, which can result in unintentional omission of important parameters like proxyUser or default Spark configs.

To Reproduce

  1. Define a ~/.sparkmagic/config.json file with the following:
"session_configs": {
  "proxyUser": "jeffrey.zzz",
  "conf": {
    "spark.sql.catalog.spark_catalog.type": "hive"
  }
}
  1. Run the following in a notebook:
%%configure -f
{
  "conf": {
    "spark.executor.memory": "8g"
  }
}

Expected behavior
Expected that the new settings provided via %%configure would be merged with the existing session_configs, or at least that the documentation would explicitly warn that a full replacement occurs.

Screenshots
N/A

Versions:

  • SparkMagic: 0.21.0
  • Livy: (if known)
  • Spark: (if known)

Additional context
This behavior stems from the override() function in configuration.py#L34, where:

overrides[config] = value

This line replaces the full session_configs object rather than merging it with prior contents.

It would be helpful to clarify this behavior in the documentation or consider enhancing the configuration logic to support merging, or at least offer a warning when this overwrite occurs.

Thanks for maintaining SparkMagic!

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind:bugAn unexpected error or issue with sparkmagic

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions