[SPARK-58114][PYTHON] Consolidate VALUE_NOT_ANY_OR_ALL into VALUE_NOT_ALLOWED#57250
Open
marcuslin123 wants to merge 1 commit into
Open
[SPARK-58114][PYTHON] Consolidate VALUE_NOT_ANY_OR_ALL into VALUE_NOT_ALLOWED#57250marcuslin123 wants to merge 1 commit into
marcuslin123 wants to merge 1 commit into
Conversation
HyukjinKwon
approved these changes
Jul 15, 2026
uros-b
reviewed
Jul 15, 2026
uros-b
left a comment
Member
There was a problem hiding this comment.
Is this superseded by #57236? @marcuslin123 @HyukjinKwon, cc @zhengruifeng @dongjoon-hyun
Member
If so, let's please consider closing the current PR. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes were proposed in this pull request?
Remove the specialized
VALUE_NOT_ANY_OR_ALLPySpark error condition and replace its single use site (DataFrame.dropna'showvalidation, in both classic and Spark Connect) with the more generalVALUE_NOT_ALLOWEDcondition, which already exists and expresses the same thing via anallowed_valuesparameter.Before:
After (reusing the existing general condition):
Why are the changes needed?
VALUE_NOT_ANY_OR_ALLis a narrow, single-purpose error condition that duplicates whatVALUE_NOT_ALLOWEDalready provides generically. Consolidating reduces the number of error conditions to maintain and keepsdropna's error consistent with other "value must be one of a fixed set" validations across PySpark (e.g.between, profiler options).Does this PR introduce any user-facing change?
Yes, a minor change to the error message for
df.dropna(how=<invalid>). Previously: "Value forhowmust be 'any' or 'all', got 'foo'." Now: "Value forhowhas to be amongst the following values: ['any', 'all']." The raised exception type (PySparkValueError) is unchanged.How was this patch tested?
Updated the existing regression test in
test_stat.pyto assert theVALUE_NOT_ALLOWEDcondition and its parameters. Test passes:python/run-tests --testnames "pyspark.sql.tests.test_stat DataFrameStatTests.test_dropna"Was this patch authored or co-authored using generative AI tooling?
Generative AI tooling (Claude Code) was used as an assistive tool for implementation guidance.