hello-stephen commented on code in PR #71031:
URL: https://github.com/apache/doris/pull/71031#discussion_r4696843949


##########
fe/fe-connector/fe-connector-iceberg/src/main/java/org/apache/doris/connector/iceberg/IcebergGoogleCredentialValidator.java:
##########
@@ -0,0 +1,59 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package org.apache.doris.connector.iceberg;
+
+import com.google.api.client.json.GenericJson;
+import com.google.api.client.json.JsonObjectParser;
+import com.google.api.client.json.gson.GsonFactory;
+
+import java.io.IOException;
+import java.io.StringReader;
+import java.util.Map;
+
+/** Checks the JSON fields the Google SDK consumes without resolving 
credential sources. */
+final class IcebergGoogleCredentialValidator {
+    private IcebergGoogleCredentialValidator() {
+    }
+
+    static void validate(Map<String, String> properties) {
+        String json = properties.get("gcp.auth.credentials-json");
+        if (json == null) {

Review Comment:
   [P2] Preserve the SDK's empty inline-credential fallback
   
   [Iceberg 1.12's 
GoogleAuthManager](https://github.com/apache/iceberg/blob/apache-iceberg-1.12.0/gcp/src/main/java/org/apache/iceberg/gcp/auth/GoogleAuthManager.java#L79-L108)
 treats `gcp.auth.credentials-json=""` as unset and selects 
`gcp.auth.credentials-path` or ADC. This validator only skips `null`, so an 
existing Google-auth REST catalog can no longer switch from inline JSON to a 
file with `ALTER CATALOG ... SET PROPERTIES ("gcp.auth.credentials-json"="", 
"gcp.auth.credentials-path"="/operator/key.json")`: parsing the empty input 
fails. Since ALTER retains existing keys and this validator also runs from 
`buildCatalogProperties`, persisted catalogs using empty JSON with a file/ADC 
also stop initializing after upgrade. Skip empty strings here, matching the 
SDK, and cover that fallback at the CREATE/ALTER/runtime entry points.



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