Gabriel39 commented on code in PR #71205:
URL: https://github.com/apache/doris/pull/71205#discussion_r4792896383


##########
fe/fe-connector/fe-connector-metastore-spi/src/main/java/org/apache/doris/connector/metastore/spi/AbstractDlfMetaStoreProperties.java:
##########
@@ -140,4 +138,54 @@ public Map<String, String> toDlfCatalogConf() {
         MetaStoreParseUtils.applyStorageConfig(storageHadoopConfig, raw, 
conf::put);
         return conf;
     }
+
+    /** Resolves the active literal service peer before a holder or an SDK 
client is constructed. */
+    public static Map<String, String> serviceEndpointValues(Map<String, 
String> properties) {
+        // The proxy never constructs a DLF client in METASTORE_ONLY mode.
+        if ("METASTORE_ONLY".equals(proxyMode(properties))) {
+            return Map.of();
+        }
+        String endpointKey = firstKey(properties, "dlf.endpoint", 
"dlf.catalog.endpoint");
+        String regionKey = firstKey(properties, "dlf.region", 
"dlf.catalog.region");
+        String sourceKey = endpointKey == null ? regionKey : endpointKey;
+        if (sourceKey == null) {
+            return Map.of();
+        }
+        String accessPublic = firstValue(properties, "dlf.access.public", 
"dlf.catalog.accessPublic");
+        return Map.of(sourceKey, resolveEndpoint(firstValue(properties, 
"dlf.endpoint", "dlf.catalog.endpoint"),
+                firstValue(properties, "dlf.region", "dlf.catalog.region"),
+                ConnectorPropertiesUtils.parseBooleanProperty(
+                        accessPublic.isEmpty() ? "false" : accessPublic, 
"dlf.access.public")));
+    }
+
+    public static boolean usesHmsClient(Map<String, String> properties) {
+        return !"DLF_ONLY".equals(proxyMode(properties));
+    }
+
+    private static String proxyMode(Map<String, String> properties) {
+        String mode = firstValue(properties, "dlf.catalog.proxyMode", 
"dlf.proxy.mode");
+        return mode.isEmpty() ? "DLF_ONLY" : mode;
+    }
+
+    private static String resolveEndpoint(String endpoint, String region, 
boolean publicAccess) {
+        validateEndpointRegion(endpoint, region);
+        // Admission and the consumer must derive the identical public or VPC 
service host.
+        return StringUtils.isBlank(endpoint) && StringUtils.isNotBlank(region)
+                ? (publicAccess ? "dlf." : "dlf-vpc.") + region + 
".aliyuncs.com" : endpoint;
+    }
+
+    private static String firstValue(Map<String, String> properties, String... 
aliases) {
+        String key = firstKey(properties, aliases);
+        return key == null ? "" : properties.get(key).trim();
+    }
+
+    private static String firstKey(Map<String, String> properties, String... 
aliases) {
+        for (String key : aliases) {
+            String value = properties.get(key);
+            if (StringUtils.isNotBlank(value)) {

Review Comment:
   Fixed in 04aeca14e2ca070bbe9f7ed09a899ea7b67b0419.
   
   The shared DLF alias helper now uses the String binder trim-empty presence 
rule for endpoint, region, public access and proxy mode. Recording cases cover 
Hive, Iceberg and Paimon; a pure real-holder test compares selected fields and 
service projection with ASCII controls 0 and 31. SQL separately covers ordinary 
blank canonical modes, fallback activation and rejected-update retention for 
all three catalog paths.
   
   The current head passed 2954 FE tests, strict FE Checkstyle, a fresh FE 
build, and both local SQL suites. Scope and verification limits are recorded in 
the PR description.



-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to