marcuslin123 opened a new pull request, #57135:
URL: https://github.com/apache/spark/pull/57135

   ### What changes were proposed in this pull request?
   
   Fix the `messageParameters` key in `DataFrame.dropna` validation from 
`arg_type` to `arg_value`, matching the `VALUE_NOT_ANY_OR_ALL` error template 
which interpolates `<arg_value>`.
   
   ### Why are the changes needed?
   
   `df.dropna(how="foo")` is meant to raise a clear `PySparkValueError` saying 
"Value for `how` must be 'any' or 'all', got 'foo'." Instead, the mismatch 
between the template placeholder (`<arg_value>`) and the provided parameter key 
(`arg_type`) causes an internal assertion failure, surfacing an opaque 
`AssertionError` to the user.
   
   ### Does this PR introduce _any_ user-facing change?
   
   Yes. Users who pass an invalid `how` argument to `DataFrame.dropna` will now 
see:
   
   ```
   PySparkValueError: [VALUE_NOT_ANY_OR_ALL] Value for `how` must be 'any' or 
'all', got 'foo'.
   ```
   
   Instead of the previous opaque `AssertionError`.
   
   ### How was this patch tested?
   
   Added a regression test in `test_stat.py` within the existing `test_dropna` 
method that verifies `dropna(how="foo")` raises `PySparkValueError` with the 
correct error class and parameters.
   
   ### 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.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to