CalvinKirs commented on code in PR #56311:
URL: https://github.com/apache/doris/pull/56311#discussion_r2372269304


##########
fe/fe-core/src/main/java/org/apache/doris/datasource/property/metastore/IcebergGlueMetaStoreProperties.java:
##########
@@ -83,11 +83,31 @@ private void appendS3Props(Map<String, String> props) {
 
     private void appendGlueProps(Map<String, String> props) {
         props.put(AwsProperties.GLUE_CATALOG_ENDPOINT, 
glueProperties.glueEndpoint);
-        props.put("client.credentials-provider",
-                
"com.amazonaws.glue.catalog.credentials.ConfigurationAWSCredentialsProvider2x");
-        props.put("client.credentials-provider.glue.access_key", 
glueProperties.glueAccessKey);
-        props.put("client.credentials-provider.glue.secret_key", 
glueProperties.glueSecretKey);
-        props.put("aws.catalog.credentials.provider.factory.class",
-                
"com.amazonaws.glue.catalog.credentials.ConfigurationAWSCredentialsProviderFactory");
+
+        if (StringUtils.isNotBlank(glueProperties.glueAccessKey) && StringUtils
+                .isNotBlank(glueProperties.glueSecretKey)) {
+            props.put("client.credentials-provider",
+                    
"com.amazonaws.glue.catalog.credentials.ConfigurationAWSCredentialsProvider2x");
+            props.put("client.credentials-provider.glue.access_key", 
glueProperties.glueAccessKey);
+            props.put("client.credentials-provider.glue.secret_key", 
glueProperties.glueSecretKey);
+            props.put("aws.catalog.credentials.provider.factory.class",
+                    
"com.amazonaws.glue.catalog.credentials.ConfigurationAWSCredentialsProviderFactory");
+            if (StringUtils.isNotBlank(glueProperties.glueSessionToken)) {
+                props.put("client.credentials-provider.glue.session_token", 
glueProperties.glueSessionToken);
+            }
+            return;
+        }

Review Comment:
   It’s just a personal preference—readability is much better this way, and 
deeply nested if/else statements aren’t very readable.



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