RequiredParameters in Flink 1.5.1

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

RequiredParameters in Flink 1.5.1

Flavio Pompermaier
Hi to all,
I'm trying to migrate a job from Flink 1.3.1 to 1.5.1 but it seems that RequiredParameters and ParameterTool works differently from before...

My code is the following:

ParameterTool parameters = ParameterTool.fromArgs(args);
RequiredParameters required = new RequiredParameters();
required.add(getMyBooleanOption());
required.applyTo(parameters);

where getMyBooleanOption() creates an Option 'xxx' with a default value of "true".

In Flink 1.3.1 parameters.getBoolean(getMyBooleanOption().getName()) returns true while in 1.5.1 throws an exception:

Exception in thread "main" java.lang.RuntimeException: No data for required key 'xxx'
at org.apache.flink.api.java.utils.ParameterTool.getRequired(ParameterTool.java:289)
at org.apache.flink.api.java.utils.ParameterTool.getBoolean(ParameterTool.java:427)

Is this a regression or is the inteded behaviour? This could be simply fixed using

parameters.getBoolean(getMyBooleanOption().getName(),Boolean.valueOf(getMyBooleanOption().getDefaultValue()));

but the previous mechanism was better (IMHO).

Thanks in advance,
Flavio