akalash commented on a change in pull request #18482:
URL: https://github.com/apache/flink/pull/18482#discussion_r793602159
##########
File path:
flink-clients/src/main/java/org/apache/flink/client/cli/CancelOptions.java
##########
@@ -33,11 +37,21 @@
/** Optional target directory for the savepoint. Overwrites cluster
default. */
private final String targetDirectory;
+ private final SavepointFormatType formatType;
+
public CancelOptions(CommandLine line) {
super(line);
this.args = line.getArgs();
this.withSavepoint =
line.hasOption(CANCEL_WITH_SAVEPOINT_OPTION.getOpt());
this.targetDirectory =
line.getOptionValue(CANCEL_WITH_SAVEPOINT_OPTION.getOpt());
+ if (line.hasOption(SAVEPOINT_FORMAT_OPTION)) {
+ formatType =
+ ConfigurationUtils.convertValue(
+ line.getOptionValue(SAVEPOINT_FORMAT_OPTION),
+ SavepointFormatType.class);
+ } else {
+ formatType = SavepointFormatType.DEFAULT;
Review comment:
I am talking about this:
```
if (line.hasOption(SAVEPOINT_FORMAT_OPTION)) {
formatType =
ConfigurationUtils.convertValue(
line.getOptionValue(SAVEPOINT_FORMAT_OPTION),
SavepointFormatType.class);
} else {
formatType = SavepointFormatType.DEFAULT;
}
```
I actually expect here something like this:
```
formatType =
SavepointFormatType.fromString(line.getOptionValue(SAVEPOINT_FORMAT_OPTION));
```
Another proposal to create `convertValue` method with default:
```
ConfigurationUtils.convertValue(
line.getOptionValue(SAVEPOINT_FORMAT_OPTION),
SavepointFormatType.class,
SavepointFormatType.DEFAULT);
```
But in general, I understand your point that it is a kind of different
representation level. But anyway I would expect the method something like
`getOrDefault(line, SAVEPOINT_FORMAT_OPTION)`. In fact, it is not critical for
me, if you think that any changes don't make any sense we can leave it as is.
--
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]