package io.github.interestinglab.waterdrop.config;


import java.io.File;
import java.util.Map;

public class ExposeSparkDriverConf {

    public static void main(String[] args) throws Exception {
        Config appConfig = ConfigFactory.parseFile(new File(args[0]))
                .resolve(ConfigResolveOptions.defaults().setAllowUnresolved(true))
                .resolveWith(ConfigFactory.systemProperties(), ConfigResolveOptions.defaults().setAllowUnresolved(true));

        String driverPrefix = "spark.driver.";
        Config sparkConfig = appConfig.getConfig("spark");

        if (!TypesafeConfigUtils.hasSubConfig(sparkConfig, driverPrefix)) {
            System.out.println("");
        } else {
            Config sparkDriverConfig = TypesafeConfigUtils.extractSubConfig(sparkConfig, driverPrefix, false);
            StringBuilder stringBuilder = new StringBuilder();
            for (Map.Entry<String, ConfigValue> entry: sparkDriverConfig.entrySet()) {
                String conf = String.format(" --driver-%s=%s ", entry.getKey(), entry.getValue().unwrapped());
                stringBuilder.append(conf);
            }

            System.out.println(stringBuilder.toString());
        }
    }
}

@@ -62,15 +62,46 @@
 ava.
-io.File
+util.LinkedList;%0Aimport java.util.List
 ;%0Aim
@@ -120,16 +120,38 @@
 il.Map;%0A
+import java.io.File;%0A%0A
 %0Apublic 
@@ -181,16 +181,584 @@
 Conf %7B%0A%0A
+    public static List%3CString%3E splitKey(String key) %7B%0A        List%3CString%3E keys = new LinkedList%3C%3E();%0A        int index = 0;%0A        for (int i = 0; i %3C key.length(); i ++) %7B%0A            char symbol = key.charAt(i);%0A            if (symbol %3E= 'A' && symbol %3C= 'Z') %7B%0A                keys.add(key.substring(index, i).toLowerCase());%0A                index = i;%0A            %7D%0A        %7D%0A%0A        keys.add(key.substring(index).toLowerCase());%0A%0A        if (keys.get(0).equals(%22extra%22)) %7B%0A            return keys.subList(1, keys.size());%0A        %7D%0A        return keys;%0A    %7D%0A%0A
     publ
@@ -1580,24 +1580,86 @@
 trySet()) %7B%0A
+                List%3CString%3E keys = splitKey(entry.getKey());%0A
             
@@ -1710,29 +1710,37 @@
 s=%25s %22, 
-entry.getKey(
+String.join(%22-%22, keys
 ), entry

Support spark.driver.extra*