Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SPARK-46277][PYTHON] Validate startup urls with the config being set #44194

Closed
wants to merge 3 commits into from

Conversation

xinrong-meng
Copy link
Member

What changes were proposed in this pull request?

Validate startup urls with the config being set, see example in the "Does this PR introduce any user-facing change".

Why are the changes needed?

Clear and user-friendly error messages.

Does this PR introduce any user-facing change?

Yes.

FROM

>>> SparkSession.builder.config(map={"spark.master": "x", "spark.remote": "y"})
<pyspark.sql.session.SparkSession.Builder object at 0x7fa310115b20

>>> SparkSession.builder.config(map={"spark.master": "x", "spark.remote": "y"}).config("x", "z")  # Only raises the error when adding new configs
Traceback (most recent call last):
...
RuntimeError: Spark master cannot be configured with Spark Connect server; however, found URL for Spark Connect [y]

TO

>>> SparkSession.builder.config(map={"spark.master": "x", "spark.remote": "y"})
Traceback (most recent call last):
...
RuntimeError: Spark master cannot be configured with Spark Connect server; however, found URL for Spark Connect [y]

How was this patch tested?

Unit tests.

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

No.

@HyukjinKwon HyukjinKwon changed the title [SPARK-46277][PYSPARK] Validate startup urls with the config being set [SPARK-46277][PYTHON] Validate startup urls with the config being set Dec 5, 2023
@xinrong-meng xinrong-meng marked this pull request as ready for review December 6, 2023 01:22
@xinrong-meng
Copy link
Member Author

xinrong-meng commented Dec 7, 2023

Rebased changes from master and adjusted errors per 9fefb05.

@xinrong-meng
Copy link
Member Author

Also cc @itholic for error class changes

dbatomic pushed a commit to dbatomic/spark that referenced this pull request Dec 11, 2023
### What changes were proposed in this pull request?
Validate startup urls with the config being set, see example in the "Does this PR introduce _any_ user-facing change".

### Why are the changes needed?
Clear and user-friendly error messages.

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

FROM
```py
>>> SparkSession.builder.config(map={"spark.master": "x", "spark.remote": "y"})
<pyspark.sql.session.SparkSession.Builder object at 0x7fa310115b20

>>> SparkSession.builder.config(map={"spark.master": "x", "spark.remote": "y"}).config("x", "z")  # Only raises the error when adding new configs
Traceback (most recent call last):
...
RuntimeError: Spark master cannot be configured with Spark Connect server; however, found URL for Spark Connect [y]
```

TO
```py
>>> SparkSession.builder.config(map={"spark.master": "x", "spark.remote": "y"})
Traceback (most recent call last):
...
RuntimeError: Spark master cannot be configured with Spark Connect server; however, found URL for Spark Connect [y]
```

### How was this patch tested?
Unit tests.

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

Closes apache#44194 from xinrong-meng/fix_session.

Authored-by: Xinrong Meng <xinrong@apache.org>
Signed-off-by: Xinrong Meng <xinrong@apache.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants