hddong commented on a change in pull request #1174: [HUDI-96]: Implemented 
command line options instead of positional arguments for CLI commands
URL: https://github.com/apache/incubator-hudi/pull/1174#discussion_r399733999
 
 

 ##########
 File path: 
hudi-cli/src/main/java/org/apache/hudi/cli/commands/CleansCommand.java
 ##########
 @@ -136,9 +139,17 @@ public String runClean(@CliOption(key = "sparkMemory", 
unspecifiedDefaultValue =
         
Utils.getDefaultPropertiesFile(JavaConverters.mapAsScalaMapConverter(System.getenv()).asScala());
     SparkLauncher sparkLauncher = SparkUtil.initLauncher(sparkPropertiesPath);
 
-    String cmd = SparkMain.SparkCommand.CLEAN.toString();
-    sparkLauncher.addAppArgs(cmd, metaClient.getBasePath(), master, 
propsFilePath, sparkMemory);
-    UtilHelpers.validateAndAddProperties(configs, sparkLauncher);
+    HoodieCleaner.Config config = new HoodieCleaner.Config();
+    config.configs = Arrays.asList(configs);
+    if (!Strings.isNullOrEmpty(propsFilePath)) {
+      config.propsFilePath = propsFilePath;
+    }
+    config.basePath = metaClient.getBasePath();
+    config.sparkMaster = master;
+    config.sparkMemory = sparkMemory;
+    String[] commandConfig = 
config.getCommandConfigsAsStringArray(SparkMain.SparkCommand.CLEAN.toString());
+    sparkLauncher.addAppArgs(commandConfig);
 
 Review comment:
   Need we construct `Config` class here? How about passing raw parameters and 
construct config in `SparkMain`,  like `compact` function does.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to