dejankrak-db opened a new pull request, #58766: URL: https://github.com/apache/spark/pull/58766
### What changes were proposed in this pull request? A JDBC read with a null `url` option satisfies the presence check `require(parameters.isDefinedAt(JDBC_URL), ...)` in `JDBCOptions` (the key is present), but the value itself is `null`. That null then flows into `DriverManager.getDriver(url)`, which throws a raw `NullPointerException` surfacing to the user as an opaque `INTERNAL_ERROR`. This PR guards the null value right after it is read in `JDBCOptions` and throws the user-facing `NULL_DATA_SOURCE_OPTION` error instead, mirroring the existing null-value guard already present in `JDBCOptions.asProperties`. ### Why are the changes needed? A null option value is a user input error, not an internal Spark failure. It should be reported with the actionable `NULL_DATA_SOURCE_OPTION` error class (pointing at the `url` option) rather than a `NullPointerException` / `INTERNAL_ERROR`, which is confusing and looks like a Spark bug. ### Does this PR introduce _any_ user-facing change? Yes. Constructing a JDBC relation with a null `url` option now fails with the `NULL_DATA_SOURCE_OPTION` error (a `SparkIllegalArgumentException`) instead of a `NullPointerException` surfaced as `INTERNAL_ERROR`. No change for valid inputs. ### How was this patch tested? Added a unit test in `JdbcUtilsSuite` that constructs `JDBCOptions` with a null `url` and asserts the `NULL_DATA_SOURCE_OPTION` error is raised with the expected `option` parameter. ### Was this patch authored or co-authored using generative AI tooling? Generated-by: Isaac This pull request and its description were written by Isaac. -- 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]
