zuston commented on code in PR #9:
URL: https://github.com/apache/incubator-uniffle/pull/9#discussion_r912373979
##########
common/src/main/java/com/tencent/rss/common/config/ConfigOptions.java:
##########
@@ -208,4 +217,69 @@ public ConfigOption<T> noDefaultValue() {
converter);
}
}
+
+ /**
+ * Builder for {@link ConfigOption} of list of type {@link E}.
+ *
+ * @param <E> list element type of the option
+ */
+ public static class ListConfigOptionBuilder<E> {
+ private final String key;
+ private final Class<E> clazz;
+ private final Function<Object, E> atomicConverter;
+ private Function<Object, List<E>> asListConverter;
+
+ public ListConfigOptionBuilder(String key, Class<E> clazz,
Function<Object, E> atomicConverter) {
+ this.key = key;
+ this.clazz = clazz;
+ this.atomicConverter = atomicConverter;
+ this.asListConverter = (v) -> {
+ return Arrays.stream(v.toString().split(LIST_SPILTTER))
+ .map(s ->
atomicConverter.apply(s)).collect(Collectors.toList());
+ };
+ }
+
+ public ListConfigOptionBuilder checkValue(Function<E, Boolean>
checkValueFunc, String errMsg) {
+ Function<Object, List<E>> newConverter = (v) -> {
+ List<E> list = Arrays.stream(v.toString().split(LIST_SPILTTER))
+ .map(s ->
atomicConverter.apply(s)).collect(Collectors.toList());
Review Comment:
Flink don’t support checkvalue. But it is added in uniffle
TypedConfigOptionBuilder. And i think it’s useful and add it into
ListConfigOptionBuilder
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]