adonis0147 commented on code in PR #21837:
URL: https://github.com/apache/doris/pull/21837#discussion_r1308473532
##########
fe/fe-core/src/main/java/org/apache/doris/catalog/SparkResource.java:
##########
@@ -159,16 +161,30 @@ public Map<String, String> getSparkConfigs() {
}
public Map<String, String> getEnvConfigsWithoutPrefix() {
- Map<String, String> envConfig = Maps.newHashMap();
+ Map<String, String> systemEnvWithPrefix =
getSystemEnvConfigsWithPrefix();
+ Map<String, String> currentEnvConfigs = new
HashMap<>(systemEnvWithPrefix);
if (envConfigs != null) {
for (Map.Entry<String, String> entry : envConfigs.entrySet()) {
if (entry.getKey().startsWith(ENV_PREFIX)) {
String key = entry.getKey().substring(ENV_PREFIX.length());
- envConfig.put(key, entry.getValue());
+ currentEnvConfigs.put(key, entry.getValue());
}
}
}
- return envConfig;
+ return currentEnvConfigs;
+ }
+
+ public Map<String, String> getSystemEnvConfigsWithPrefix() {
+ Map<String, String> systemEnv = System.getenv();
+ Map<String, String> systemEnvWithPrefix = new HashMap<>();
+ for (Entry<String, String> entry : systemEnv.entrySet()) {
+ String key = entry.getKey();
+ String value = entry.getValue();
+ if (key.startsWith(ENV_PREFIX)) {
+ systemEnvWithPrefix.put(key, value);
+ }
+ }
+ return systemEnvWithPrefix;
Review Comment:
```suggestion
public Map<String, String> getEnvConfigsWithoutPrefix() {
Map<String, String> envConfig = System.getenv().entrySet().stream()
.filter(entry -> entry.getKey().startsWith(ENV_PREFIX))
.collect(Collectors.toMap(entry ->
entry.getKey().substring(ENV_PREFIX), Entry::getValue));
if (envConfigs != null) {
for (Map.Entry<String, String> entry : envConfigs.entrySet()) {
if (entry.getKey().startsWith(ENV_PREFIX)) {
String key =
entry.getKey().substring(ENV_PREFIX.length());
envConfig.put(key, entry.getValue());
}
}
}
return envConfig;
```
--
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]