diff --git a/fe/fe-core/src/main/java/org/apache/doris/datasource/iceberg/IcebergExternalCatalog.java b/fe/fe-core/src/main/java/org/apache/doris/datasource/iceberg/IcebergExternalCatalog.java index 7282de52aa0d22..30590f5af26070 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/datasource/iceberg/IcebergExternalCatalog.java +++ b/fe/fe-core/src/main/java/org/apache/doris/datasource/iceberg/IcebergExternalCatalog.java @@ -68,6 +68,18 @@ protected void initLocalObjectsImpl() { metadataOps = ops; } + /** + * Returns the underlying {@link Catalog} instance used by this external catalog. + * + *

Warning: This method does not handle any authentication logic. If the + * returned catalog implementation relies on external systems + * that require authentication — especially in environments where Kerberos is enabled — the caller is + * fully responsible for ensuring the appropriate authentication has been performed before + * invoking this method. + *

Failing to authenticate beforehand may result in authorization errors or IO failures. + * + * @return the underlying catalog instance + */ public Catalog getCatalog() { makeSureInitialized(); return ((IcebergMetadataOps) metadataOps).getCatalog(); diff --git a/fe/fe-core/src/main/java/org/apache/doris/datasource/iceberg/IcebergExternalDatabase.java b/fe/fe-core/src/main/java/org/apache/doris/datasource/iceberg/IcebergExternalDatabase.java index 7a1a53825a15d3..2e4e45f062e7be 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/datasource/iceberg/IcebergExternalDatabase.java +++ b/fe/fe-core/src/main/java/org/apache/doris/datasource/iceberg/IcebergExternalDatabase.java @@ -41,8 +41,14 @@ public IcebergExternalTable buildTableInternal(String remoteTableName, String lo } public String getLocation() { - Map props = ((SupportsNamespaces) ((IcebergExternalCatalog) getCatalog()).getCatalog()) - .loadNamespaceMetadata(Namespace.of(name)); - return props.getOrDefault("location", ""); + try { + return extCatalog.getPreExecutionAuthenticator().execute(() -> { + Map props = ((SupportsNamespaces) ((IcebergExternalCatalog) getCatalog()).getCatalog()) + .loadNamespaceMetadata(Namespace.of(name)); + return props.getOrDefault("location", ""); + }); + } catch (Exception e) { + throw new RuntimeException("Failed to get location for Iceberg database: " + name, e); + } } }