dawidwys commented on a change in pull request #11070: [FLINK-16013][core]
Write and parse list config option correctly
URL: https://github.com/apache/flink/pull/11070#discussion_r378922012
##########
File path:
flink-core/src/main/java/org/apache/flink/configuration/Configuration.java
##########
@@ -958,6 +958,12 @@ private String convertToString(Object o) {
} else if (o.getClass() == Duration.class) {
Duration duration = (Duration) o;
return String.format("%d ns", duration.toNanos());
+ } else if (o instanceof List) {
+ return String.join(";", ((List<?>)
o).stream().map(Object::toString).toArray(String[]::new));
Review comment:
Could you also escape the entries in the list? Parsing lists supports
escaping with `'` character.
So that e.g. A;'A;B';C is parsed as ["A", "A;B", "C"]. The same applies for
Maps. I think when writing values out it's safe to always escape them.
You can check some examples of escaping in `StructuredOptionsSplitterTest`
or in `ReadableWritableConfigurationTest` see test for `list<string>`.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services