Skip to content

Commit

Permalink
Disallow --master with Spark Connect URL
Browse files Browse the repository at this point in the history
  • Loading branch information
HyukjinKwon committed Feb 19, 2025
1 parent 0af25b8 commit 68a02ed
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions python/pyspark/errors/error-conditions.json
Original file line number Diff line number Diff line change
Expand Up @@ -512,6 +512,11 @@
"A master URL must be set in your configuration."
]
},
"MASTER_URL_INVALID": {
"message": [
"Master must either be yarn or start with spark, k8s, or local."
]
},
"MEMORY_PROFILE_INVALID_SOURCE":{
"message": [
"Memory profiler can only be used on editors with line numbers."
Expand Down
5 changes: 5 additions & 0 deletions python/pyspark/sql/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -508,6 +508,11 @@ def getOrCreate(self) -> "SparkSession":

if url is None and is_api_mode_connect:
url = opts.get("spark.master", os.environ.get("MASTER", "local"))
if url.startswith("sc://"):
raise PySparkRuntimeError(
errorClass="MASTER_URL_INVALID",
messageParameters={},
)

if url is None:
raise PySparkRuntimeError(
Expand Down

0 comments on commit 68a02ed

Please sign in to comment.