yuqi1129 commented on code in PR #11959:
URL: https://github.com/apache/gravitino/pull/11959#discussion_r3551451922
##########
catalogs/catalog-lakehouse-iceberg/src/main/java/org/apache/gravitino/catalog/lakehouse/iceberg/IcebergCatalog.java:
##########
@@ -68,6 +68,24 @@ public ViewCatalog asViewCatalog() {
return (ViewCatalog) ops();
}
+ /**
+ * Validate the backend connection at create time only when a {@code
warehouse} is configured.
+ *
+ * <p>On the {@code rest} backend the {@code warehouse} property is a
catalog selector forwarded
+ * to the remote Iceberg REST server (via {@code GET
/v1/config?warehouse=...}), not a storage
+ * location. Resolving it at create time turns an unresolvable value (for
example a
+ * storage-location-shaped URI mistakenly copied from a hive/jdbc example)
into a fast, actionable
+ * failure. An omitted {@code warehouse} (the server's default REST catalog)
needs no resolution,
+ * so creation is not forced to touch the backend in that case.
+ *
+ * @return {@code true} if a non-blank {@code warehouse} is configured,
{@code false} otherwise.
+ */
+ @Override
+ public boolean shouldValidateConnectionForCreate() {
+ Map<String, String> properties = entity().getProperties();
+ return properties != null &&
StringUtils.isNotBlank(properties.get(IcebergConstants.WAREHOUSE));
Review Comment:
I'm not very clear about why we need to validate the connection if
`warehouse` is not empty. According to the Java documentation, do you only need
to check the connection when `type` is `rest`? I remember for `jdbc`, `hive`,
it's only not empty, so we will change them all?
--
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]