diqiu50 opened a new issue, #13583:
URL: https://github.com/apache/gravitino/issues/13583
### Version
main branch
### Describe what's wrong
For a jdbc-backed Iceberg catalog that is eligible for Iceberg REST routing,
`GravitinoIcebergCatalog.createAndInitSparkCatalog` loads the catalog's
`jdbc-driver` with `Class.forName` before deciding whether to route. When the
catalog is routed, the Spark client only talks to the Iceberg REST server and
never uses the backend driver. Even so, catalog initialization fails if the
driver isn't on the Spark classpath.
### Error message and/or stacktrace
```
java.lang.RuntimeException: java.lang.ClassNotFoundException:
org.postgresql.Driver
at
org.apache.gravitino.spark.connector.iceberg.GravitinoIcebergCatalog.createAndInitSparkCatalog(GravitinoIcebergCatalog.java:83)
```
### How to reproduce
1. Create an Iceberg catalog with `catalog-backend=jdbc`,
`uri=jdbc:postgresql://...`, `jdbc-driver=org.postgresql.Driver`,
`warehouse=s3://...`, `credential-providers=s3-token`.
2. In Spark with the Gravitino connector and Iceberg support turned on, and
without the PostgreSQL driver on the classpath, run `SHOW NAMESPACES IN
<catalog>`.
### Additional context
The driver preload should only apply on the legacy Hive/JDBC backend
translation path.
--
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]