You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@polaris.apache.org by di...@apache.org on 2026/01/05 18:51:31 UTC

(polaris) branch main updated: Deprecate untyped `RealmConfig.getConfig()` (#3323)

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

dimas 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 4cf09ec77 Deprecate untyped `RealmConfig.getConfig()` (#3323)
4cf09ec77 is described below

commit 4cf09ec77c77e01fc4b375c635b11a9e474b1281
Author: Dmitri Bourlatchkov <dm...@gmail.com>
AuthorDate: Mon Jan 5 13:51:27 2026 -0500

    Deprecate untyped `RealmConfig.getConfig()` (#3323)
    
    * `getConfig(String)` has a generic return type, but the call path that gets the value does not perform any type validation.
    
    * Deprecate this method in favour of well-typed `getConfig(PolarisConfiguration)`
    
    * Migrate the single use case in Polaris code to the well-typed method.
---
 .../src/main/java/org/apache/polaris/core/config/RealmConfig.java      | 2 ++
 .../java/org/apache/polaris/service/catalog/common/CatalogUtils.java   | 3 ++-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/polaris-core/src/main/java/org/apache/polaris/core/config/RealmConfig.java b/polaris-core/src/main/java/org/apache/polaris/core/config/RealmConfig.java
index 026ae8e2a..62135d72d 100644
--- a/polaris-core/src/main/java/org/apache/polaris/core/config/RealmConfig.java
+++ b/polaris-core/src/main/java/org/apache/polaris/core/config/RealmConfig.java
@@ -31,7 +31,9 @@ public interface RealmConfig {
    * @param <T> the type of the configuration value
    * @param configName the name of the configuration key to check
    * @return the current value set for the configuration key, or null if not set
+   * @deprecated Use typed {@link #getConfig(PolarisConfiguration)} instead.
    */
+  @Deprecated
   <T> @Nullable T getConfig(String configName);
 
   /**
diff --git a/runtime/service/src/main/java/org/apache/polaris/service/catalog/common/CatalogUtils.java b/runtime/service/src/main/java/org/apache/polaris/service/catalog/common/CatalogUtils.java
index ce82f36e3..999b363fb 100644
--- a/runtime/service/src/main/java/org/apache/polaris/service/catalog/common/CatalogUtils.java
+++ b/runtime/service/src/main/java/org/apache/polaris/service/catalog/common/CatalogUtils.java
@@ -25,6 +25,7 @@ import java.util.stream.Collectors;
 import org.apache.iceberg.catalog.TableIdentifier;
 import org.apache.iceberg.exceptions.ForbiddenException;
 import org.apache.polaris.core.admin.model.StorageConfigInfo;
+import org.apache.polaris.core.config.FeatureConfiguration;
 import org.apache.polaris.core.config.RealmConfig;
 import org.apache.polaris.core.entity.PolarisEntitySubType;
 import org.apache.polaris.core.entity.PolarisEntityType;
@@ -77,7 +78,7 @@ public class CatalogUtils {
             restrictions -> restrictions.validate(realmConfig, identifier, locations),
             () -> {
               List<String> allowedStorageTypes =
-                  realmConfig.getConfig("SUPPORTED_CATALOG_STORAGE_TYPES");
+                  realmConfig.getConfig(FeatureConfiguration.SUPPORTED_CATALOG_STORAGE_TYPES);
               if (allowedStorageTypes != null
                   && !allowedStorageTypes.contains(StorageConfigInfo.StorageTypeEnum.FILE.name())) {
                 List<String> invalidLocations =