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-46296][PYTHON][TESTS] Test missing test coverage for captured errors (pyspark.errors.exceptions) #44224

Closed
wants to merge 1 commit into from

Conversation

HyukjinKwon
Copy link
Member

What changes were proposed in this pull request?

This PR adds tests for negative cases of getErrorClass and getSqlState. And test case for getMessageParameters for errors.

Why are the changes needed?

To improve the test coverage.

See https://app.codecov.io/gh/apache/spark/commit/1a651753f4e760643d719add3b16acd311454c76/blob/python/pyspark/errors/exceptions/captured.py This is not being tested.

Does this PR introduce any user-facing change?

No, test-only

How was this patch tested?

Manually ran the new unittest.

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

Np.

@@ -104,7 +104,7 @@ def getMessageParameters(self) -> Optional[Dict[str, str]]:
if self._origin is not None and is_instance_of(
gw, self._origin, "org.apache.spark.SparkThrowable"
):
return self._origin.getMessageParameters()
return dict(self._origin.getMessageParameters())
Copy link
Member Author

Choose a reason for hiding this comment

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

this is virtually no-op. Before this change, it returns a JVM map instance that implements Python dictionary interface. After this change, it returns a pure Python dictionary.

@HyukjinKwon
Copy link
Member Author

@HyukjinKwon HyukjinKwon changed the title [SPARK-46296[PYTHON][TESTS] Test captured errors of TestResult (pyspark.errors.exceptions) [SPARK-46296[PYTHON][TESTS] Test missing test coverage for captured errors (pyspark.errors.exceptions) Dec 7, 2023
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 HyukjinKwon changed the title [SPARK-46296[PYTHON][TESTS] Test missing test coverage for captured errors (pyspark.errors.exceptions) [SPARK-46296][PYTHON][TESTS] Test missing test coverage for captured errors (pyspark.errors.exceptions) Dec 7, 2023
@HyukjinKwon
Copy link
Member Author

Merged to master.

dbatomic pushed a commit to dbatomic/spark that referenced this pull request Dec 11, 2023
…errors (pyspark.errors.exceptions)

### What changes were proposed in this pull request?

This PR adds tests for negative cases of `getErrorClass` and `getSqlState`. And test case for `getMessageParameters` for errors.

### Why are the changes needed?

To improve the test coverage.

See https://app.codecov.io/gh/apache/spark/commit/1a651753f4e760643d719add3b16acd311454c76/blob/python/pyspark/errors/exceptions/captured.py This is not being tested.

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

No, test-only

### How was this patch tested?

Manually ran the new unittest.

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

Np.

Closes apache#44224 from HyukjinKwon/SPARK-46296.

Authored-by: Hyukjin Kwon <gurwls223@apache.org>
Signed-off-by: Hyukjin Kwon <gurwls223@apache.org>
@HyukjinKwon HyukjinKwon deleted the SPARK-46296 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
2 participants