[jira] [Created] (FLINK-16013) List config option could not be parsed correctly

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

[jira] [Created] (FLINK-16013) List config option could not be parsed correctly

Shang Yuanchun (Jira)
Yang Wang created FLINK-16013:
---------------------------------

             Summary: 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


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)