ivanjevtic-db opened a new pull request, #48188:
URL: https://github.com/apache/spark/pull/48188

   ### What changes were proposed in this pull request?
   
   NullPointerException was thrown when invalid options were provided in the 
run function of SaveIntoDataSourceCommand up to now. That is because this map 
is propagated 
[here](https://github.com/apache/spark/blob/branch-3.5/sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/jdbc/JDBCOptions.scala#L54),
 and java.util.Properties throws NPE if key/value is null. In map, a key cannot 
be null, but a value can, so that is why this NPE is possible to produce.
   I propose we send the client an appropriate error condition. I've created a 
new error condition `INVALID_OPTIONS.NULL_VALUE`. Options are checked, and the 
error is thrown if there exists an entry in options map where the value is null.
   
   ### Why are the changes needed?
   To send the client an appropriate error.
   
   ### Does this PR introduce _any_ user-facing change?
   Yes, in case invalid options are sent, we throw `INVALID_OPTIONS.NULL_VALUE` 
instead of NullPointerException.
   
   ### How was this patch tested?
   Wrote a unit test.
   
   ### Was this patch authored or co-authored using generative AI tooling?
   No.


-- 
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