LuciferYang opened a new pull request, #57556:
URL: https://github.com/apache/spark/pull/57556
### What changes were proposed in this pull request?
The catalog-plugin loading failures in `Catalogs.load` were reported with
six placeholder error conditions `_LEGACY_ERROR_TEMP_2214` through
`_LEGACY_ERROR_TEMP_2219`, none of which carried a SQLSTATE.
Group the six into a single umbrella error condition `CANNOT_LOAD_CATALOG`
(SQLSTATE `46103`), with one subclass per failure mode in the `Catalogs.load`
try/catch:
- `NOT_A_CATALOG_PLUGIN` — the class does not implement `CatalogPlugin`
- `PLUGIN_CLASS_NOT_FOUND` — `ClassNotFoundException`
- `CONSTRUCTOR_NOT_FOUND` — `NoSuchMethodException`
- `CONSTRUCTOR_NOT_ACCESSIBLE` — `IllegalAccessException`
- `ABSTRACT_CLASS` — `InstantiationException`
- `CONSTRUCTOR_FAILURE` — `InvocationTargetException`
This also drops a stray trailing `)` in the legacy `_2216`/`_2217` messages.
### Why are the changes needed?
The error-conditions README disallows new `_LEGACY_ERROR_TEMP_*` entries and
asks existing ones to be resolved. This resolves six of them. SQLSTATE `46103`
("Java Error") is consistent with the sibling `CANNOT_LOAD_FUNCTION_CLASS`; the
failures are triggered by a user-supplied `spark.sql.catalog.<name>` plugin
class, so they are user-actionable rather than system errors.
### Does this PR introduce _any_ user-facing change?
No. The `_LEGACY_ERROR_TEMP_*` names are not part of the public API. Message
text is preserved (except the stray `)` typo removal), now rendered under the
umbrella prefix.
### How was this patch tested?
Updated the existing `checkError`/condition assertions in
`CatalogLoadingSuite` and `SupportsCatalogOptionsSuite`, and added tests for
the previously-uncovered `CONSTRUCTOR_NOT_FOUND` and `ABSTRACT_CLASS`
subclasses. `build/sbt "catalyst/testOnly *CatalogLoadingSuite" "core/testOnly
org.apache.spark.SparkThrowableSuite"` passes.
### Was this patch authored or co-authored using generative AI tooling?
Generated-by: Claude Code (Opus 4.8)
--
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]