pratyakshsharma 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_r407205799
##########
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:
The purpose of this PR is to remove this passing of positional arguments and
instead have a config object. Since passing and managing lot of arguments can
get difficult at times. @hddong
----------------------------------------------------------------
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