flink-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Flavio Pompermaier <pomperma...@okkam.it>
Subject RequiredParameters in Flink 1.5.1
Date Tue, 17 Jul 2018 13:48:57 GMT
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

Mime
View raw message