This is an automated email from the ASF dual-hosted git repository.
roryqi pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/gravitino.git
The following commit(s) were added to refs/heads/main by this push:
new 175bc8b05f [#9747][followup]fix(IRC): Guard viewExists() behind
supportsViewOperations() in LoadTableAuthzHandler (#10084)
175bc8b05f is described below
commit 175bc8b05f4b7a5068f6c59504955a83594214b2
Author: Bharath Krishna <[email protected]>
AuthorDate: Mon Mar 2 07:44:27 2026 +0530
[#9747][followup]fix(IRC): Guard viewExists() behind
supportsViewOperations() in LoadTableAuthzHandler (#10084)
### What changes were proposed in this pull request?
Fix: check supportsViewOperations() before calling viewExists(). When
view operations are unsupported the identifier cannot be a view, so the
check can be skipped entirely without changing observable behavior.
### Why are the changes needed?
JDBC-backed Iceberg catalogs without 'jdbc.schema-version=V1' throw
UnsupportedOperationException from IcebergCatalogWrapper.viewExists().
LoadTableAuthzHandler.process() called viewExists() unconditionally,
causing that exception to propagate as an HTTP 500 on every loadTable
request against such catalogs.
Fix: #(issue)
### Does this PR introduce _any_ user-facing change?
no
### How was this patch tested?
Existing tests
---
.../apache/gravitino/server/web/filter/LoadTableAuthzHandler.java | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git
a/iceberg/iceberg-rest-server/src/main/java/org/apache/gravitino/server/web/filter/LoadTableAuthzHandler.java
b/iceberg/iceberg-rest-server/src/main/java/org/apache/gravitino/server/web/filter/LoadTableAuthzHandler.java
index 528b04cafa..178ce2524a 100644
---
a/iceberg/iceberg-rest-server/src/main/java/org/apache/gravitino/server/web/filter/LoadTableAuthzHandler.java
+++
b/iceberg/iceberg-rest-server/src/main/java/org/apache/gravitino/server/web/filter/LoadTableAuthzHandler.java
@@ -26,6 +26,7 @@ import java.util.Optional;
import org.apache.gravitino.Entity.EntityType;
import org.apache.gravitino.NameIdentifier;
import org.apache.gravitino.authorization.AuthorizationRequestContext;
+import org.apache.gravitino.iceberg.common.ops.IcebergCatalogWrapper;
import org.apache.gravitino.iceberg.service.IcebergCatalogWrapperManager;
import
org.apache.gravitino.iceberg.service.authorization.IcebergRESTServerContext;
import
org.apache.gravitino.server.authorization.annotations.AuthorizationMetadata;
@@ -111,9 +112,14 @@ public class LoadTableAuthzHandler implements
AuthorizationHandler {
// 3. Let request proceed - the actual loadTable() call will handle
non-existence
IcebergCatalogWrapperManager wrapperManager =
IcebergRESTServerContext.getInstance().catalogWrapperManager();
+ IcebergCatalogWrapper catalogWrapper =
wrapperManager.getCatalogWrapper(catalog);
TableIdentifier tableIdentifier = TableIdentifier.of(namespace, tableName);
- if (wrapperManager.getCatalogWrapper(catalog).viewExists(tableIdentifier))
{
+ // Only check view existence when the catalog supports view operations.
Catalogs backed by
+ // JDBC without jdbc.schema-version=V1 throw UnsupportedOperationException
from viewExists(),
+ // which would surface as a 500 error. When view operations are
unsupported the identifier
+ // cannot be a view, so we skip the check entirely.
+ if (catalogWrapper.supportsViewOperations() &&
catalogWrapper.viewExists(tableIdentifier)) {
throw new NoSuchTableException("Table %s not found", tableName);
}