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-46083][PYTHON] Make SparkNoSuchElementException as a canonical error API #43992

Conversation

HyukjinKwon
Copy link
Member

What changes were proposed in this pull request?

This PR is a kind of a followup of #43927 which added SparkNoSuchElementException into errors. This PR makes SparkNoSuchElementException as a canonical error API.

Why are the changes needed?

For the end users to catch those exceptions properly via pyspark.errors.SparkNoSuchElementException with/without Spark Connect.

Does this PR introduce any user-facing change?

Yes, it adds a new API SparkNoSuchElementException class.

How was this patch tested?

Manually tested:

./bin/pyspark
./bin/pyspark --remote local
from pyspark.errors import SparkNoSuchElementException

try:
    spark.conf.get("my_key")
except SparkNoSuchElementException as e:
    print("caught properly")

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

No.

@HyukjinKwon
Copy link
Member Author

cc @itholic

Copy link
Member

@dongjoon-hyun dongjoon-hyun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1, LGTM.

@HyukjinKwon
Copy link
Member Author

Copy link
Contributor

@itholic itholic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM when test passing.

@dongjoon-hyun
Copy link
Member

All tests passed. Merged to master for Apache Spark 4.0.0.

@HyukjinKwon HyukjinKwon deleted the error-SparkNoSuchElementException branch January 15, 2024 00:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants