wuchong commented on a change in pull request #9074: [FLINK-13198][core] 
Introduce TimeLength in configuration package
URL: https://github.com/apache/flink/pull/9074#discussion_r302341162
 
 

 ##########
 File path: 
flink-table/flink-table-common/src/main/java/org/apache/flink/table/descriptors/DescriptorProperties.java
 ##########
 @@ -540,13 +541,33 @@ public TableSchema getTableSchema(String key) {
                });
        }
 
+       /**
+        * Returns a Flink {@link TimeLength} under the given key if it exists.
+        */
+       public Optional<TimeLength> getOptionalTimeLength(String key) {
+               return optionalGet(key).map((value) -> {
+                       try {
+                               return TimeLength.parse(value, 
TimeLength.TimeUnit.MILLISECONDS);
+                       } catch (Exception e) {
+                               throw new ValidationException("Invalid time 
length value for key '" + key + "'.", e);
+                       }
+               });
+       }
+
        /**
         * Returns a Flink {@link MemorySize} under the given existing key.
         */
        public MemorySize getMemorySize(String key) {
                return 
getOptionalMemorySize(key).orElseThrow(exceptionSupplier(key));
        }
 
+       /**
+        * Returns a Flink {@link TimeLength} under the given existing key.
+        */
+       public TimeLength getTimeLength(String key) {
+               return 
getOptionalTimeLength(key).orElseThrow(exceptionSupplier(key));
+       }
+
 
 Review comment:
   Please also add `validateTimeLength` similar to `validateMemorySize`.

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

Reply via email to