This is an automated email from the ASF dual-hosted git repository.

emaynard pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/polaris.git


The following commit(s) were added to refs/heads/main by this push:
     new 1b9316932 Fix Hadoop federation to initialize the configuration prior 
to catalog initialization (#2282)
1b9316932 is described below

commit 1b9316932458e80f7d16a685f4df9c13fbe9110e
Author: Pooja Nilangekar <poo...@umd.edu>
AuthorDate: Fri Aug 8 12:57:10 2025 -0400

    Fix Hadoop federation to initialize the configuration prior to catalog 
initialization (#2282)
    
    This PR addresses the gap in Hadoop federation to ensure that we initialize 
the hadoop configuration prior to initializing the catalog object.
    
    The iceberg library expects the hadoop configuration to be initialized 
before creating a HadoopCatalog object. This change ensures that Polaris is 
compatible with the underlying iceberg library. Additionally, since the config 
initialization is based on the underlying (default) core-site.xml file, the 
change ensures that the federated catalog was created using `IMPLICIT` 
authentication mode.
    
    Testing:
    Due to current limitations in the current test setup, tested the change 
manually.
    [TODO] Add a regtest with hadoop federation once the change is baked into 
the apache/polaris docker image.
---
 .../catalog/iceberg/IcebergCatalogHandler.java       | 20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)

diff --git 
a/runtime/service/src/main/java/org/apache/polaris/service/catalog/iceberg/IcebergCatalogHandler.java
 
b/runtime/service/src/main/java/org/apache/polaris/service/catalog/iceberg/IcebergCatalogHandler.java
index 90b019a65..4395467d1 100644
--- 
a/runtime/service/src/main/java/org/apache/polaris/service/catalog/iceberg/IcebergCatalogHandler.java
+++ 
b/runtime/service/src/main/java/org/apache/polaris/service/catalog/iceberg/IcebergCatalogHandler.java
@@ -33,6 +33,7 @@ import java.util.Map;
 import java.util.Optional;
 import java.util.Set;
 import java.util.stream.Collectors;
+import org.apache.hadoop.conf.Configuration;
 import org.apache.iceberg.BaseMetadataTable;
 import org.apache.iceberg.BaseTable;
 import org.apache.iceberg.MetadataUpdate;
@@ -76,6 +77,8 @@ import 
org.apache.iceberg.rest.responses.UpdateNamespacePropertiesResponse;
 import org.apache.polaris.core.auth.PolarisAuthorizableOperation;
 import org.apache.polaris.core.auth.PolarisAuthorizer;
 import org.apache.polaris.core.config.FeatureConfiguration;
+import org.apache.polaris.core.connection.AuthenticationParametersDpo;
+import org.apache.polaris.core.connection.AuthenticationType;
 import org.apache.polaris.core.connection.ConnectionConfigInfoDpo;
 import org.apache.polaris.core.connection.ConnectionType;
 import org.apache.polaris.core.connection.hadoop.HadoopConnectionConfigInfoDpo;
@@ -232,9 +235,22 @@ public class IcebergCatalogHandler extends CatalogHandler 
implements AutoCloseab
               
connectionConfigInfoDpo.asIcebergCatalogProperties(getUserSecretsManager()));
           break;
         case HADOOP:
-          federatedCatalog = new HadoopCatalog();
+          // Currently, Polaris supports Hadoop federation only via IMPLICIT 
authentication.
+          // Hence, prior to initializing the configuration, ensure that the 
catalog uses
+          // IMPLICIT authentication.
+          AuthenticationParametersDpo authenticationParametersDpo =
+              connectionConfigInfoDpo.getAuthenticationParameters();
+          if (authenticationParametersDpo.getAuthenticationTypeCode()
+              != AuthenticationType.IMPLICIT.getCode()) {
+            throw new IllegalStateException(
+                "Hadoop federation only supports IMPLICIT authentication.");
+          }
+          Configuration conf = new Configuration();
+          String warehouse =
+              ((HadoopConnectionConfigInfoDpo) 
connectionConfigInfoDpo).getWarehouse();
+          federatedCatalog = new HadoopCatalog(conf, warehouse);
           federatedCatalog.initialize(
-              ((HadoopConnectionConfigInfoDpo) 
connectionConfigInfoDpo).getWarehouse(),
+              warehouse,
               
connectionConfigInfoDpo.asIcebergCatalogProperties(getUserSecretsManager()));
           break;
         default:

Reply via email to