You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "Yang Wang (Jira)" <ji...@apache.org> on 2020/02/13 05:41:00 UTC
[jira] [Comment Edited] (FLINK-16013) List and map config options
could not be parsed correctly
[ https://issues.apache.org/jira/browse/FLINK-16013?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17035904#comment-17035904 ]
Yang Wang edited comment on FLINK-16013 at 2/13/20 5:40 AM:
------------------------------------------------------------
[~dwysakowicz] Thanks for your suggestion. It really makes sense to put the converting {{List}} to string in {{convertToString}}.
was (Author: fly_in_gis):
[~dwysakowicz] Thanks for your suggestion. It really makes sense to put the converting {{List}} to string in {{convertToString}}.
Also i find that not only the {{List}}, also the {{Map}} could not be parsed correctly. Other complex types {{Enum}}, {{Duration}}, {{MemorySize}} work well.
> List and map config options 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
> Affects Versions: 1.10.0
> Reporter: Yang Wang
> Assignee: Yang Wang
> Priority: Major
> Labels: pull-request-available
> Fix For: 1.10.1, 1.11.0
>
> Time Spent: 10m
> Remaining Estimate: 0h
>
> 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)