zhuzhurk commented on a change in pull request #9686: [FLINK-14069] [core] Enable TimeUtils for all time units labels supported by scala Duration URL: https://github.com/apache/flink/pull/9686#discussion_r324956426
########## File path: flink-core/src/main/java/org/apache/flink/util/TimeUtils.java ########## @@ -29,9 +33,23 @@ */ public class TimeUtils { + private static final Map<String, ChronoUnit> LABEL_TO_UNIT_MAP = Collections.unmodifiableMap(initMap()); + /** * Parse the given string to a java {@link Duration}. - * The string is like "123ms", "321s", "12min" and such. + * The string is in format "{length value}{time unit label}", e.g. "123ms", "321 s". + * If no time unit label is specified, it will be considered as milliseconds. + * + * <p>Supported time unit labels are: Review comment: The supported labels are acquired from the source code of [scala.concurrent.duration.Duration](https://github.com/scala/scala/blob/f7b5b312ca5dd1333245d8174a8dbadc89bd40fc/src/library/scala/concurrent/duration/Duration.scala#L76). And I think there is no need to refer it, as we want to be compatible with scala duration labels at the moment but not with scala duration's future changes. The standard for users would only be the javadoc of flink TimeUtils then. ---------------------------------------------------------------- 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: us...@infra.apache.org With regards, Apache Git Services