[
https://issues.apache.org/jira/browse/FLINK-16013?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Yang Wang updated FLINK-16013:
------------------------------
Description:
Currently, if a config option is {{List}} type and written to a
flink-conf.yaml, it could not be parsed correctly when reloaded from yaml
resource. The root cause is we use {{List#toString}} to save into the yaml
resource. However, when we want to parse a List from a string, we use semicolon
to split the value.
The following is a unit test to reproduce this problem.
{code:java}
public void testWriteConfigurationAndReload() throws IOException {
final File flinkConfDir = temporaryFolder.newFolder().getAbsoluteFile();
final Configuration flinkConfig = new Configuration();
final ConfigOption<List<String>> listConfigOption = ConfigOptions
.key("test-list-string-key")
.stringType()
.asList()
.noDefaultValue();
final List<String> values = Arrays.asList("value1", "value2", "value3");
flinkConfig.set(listConfigOption, values);
assertThat(values,
Matchers.containsInAnyOrder(flinkConfig.get(listConfigOption).toArray()));
BootstrapTools.writeConfiguration(flinkConfig, new File(flinkConfDir,
"flink-conf.yaml"));
final Configuration loadedFlinkConfig =
GlobalConfiguration.loadConfiguration(flinkConfDir.getAbsolutePath());
assertThat(values,
Matchers.containsInAnyOrder(loadedFlinkConfig.get(listConfigOption).toArray()));
}
{code}
was:
Currently, if a config option is `List` type and written to a flink-conf.yaml,
it could not be parsed correctly when reloaded from yaml resource. The root
cause is we use `List#toString` to save into the yaml resource. However, when
we want to parse a List from a string, we use semicolon to split the value.
The following is a unit test to reproduce this problem.
{code:java}
public void testWriteConfigurationAndReload() throws IOException {
final File flinkConfDir = temporaryFolder.newFolder().getAbsoluteFile();
final Configuration flinkConfig = new Configuration();
final ConfigOption<List<String>> listConfigOption = ConfigOptions
.key("test-list-string-key")
.stringType()
.asList()
.noDefaultValue();
final List<String> values = Arrays.asList("value1", "value2", "value3");
flinkConfig.set(listConfigOption, values);
assertThat(values,
Matchers.containsInAnyOrder(flinkConfig.get(listConfigOption).toArray()));
BootstrapTools.writeConfiguration(flinkConfig, new File(flinkConfDir,
"flink-conf.yaml"));
final Configuration loadedFlinkConfig =
GlobalConfiguration.loadConfiguration(flinkConfDir.getAbsolutePath());
assertThat(values,
Matchers.containsInAnyOrder(loadedFlinkConfig.get(listConfigOption).toArray()));
}
{code}
> List config option could not be parsed correctly
> ------------------------------------------------
>
> Key: FLINK-16013
> URL: https://issues.apache.org/jira/browse/FLINK-16013
> Project: Flink
> Issue Type: Bug
> Components: Runtime / Configuration
> Reporter: Yang Wang
> Priority: Major
>
> Currently, if a config option is {{List}} type and written to a
> flink-conf.yaml, it could not be parsed correctly when reloaded from yaml
> resource. The root cause is we use {{List#toString}} to save into the yaml
> resource. However, when we want to parse a List from a string, we use
> semicolon to split the value.
>
> The following is a unit test to reproduce this problem.
> {code:java}
> public void testWriteConfigurationAndReload() throws IOException {
> final File flinkConfDir = temporaryFolder.newFolder().getAbsoluteFile();
> final Configuration flinkConfig = new Configuration();
> final ConfigOption<List<String>> listConfigOption = ConfigOptions
> .key("test-list-string-key")
> .stringType()
> .asList()
> .noDefaultValue();
> final List<String> values = Arrays.asList("value1", "value2", "value3");
> flinkConfig.set(listConfigOption, values);
> assertThat(values,
> Matchers.containsInAnyOrder(flinkConfig.get(listConfigOption).toArray()));
> BootstrapTools.writeConfiguration(flinkConfig, new File(flinkConfDir,
> "flink-conf.yaml"));
> final Configuration loadedFlinkConfig =
> GlobalConfiguration.loadConfiguration(flinkConfDir.getAbsolutePath());
> assertThat(values,
> Matchers.containsInAnyOrder(loadedFlinkConfig.get(listConfigOption).toArray()));
> }
> {code}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)