wuchong commented on a change in pull request #10468: [FLINK-14649][table sql / 
api] Flatten all the connector properties keys to make it easy to configure in 
DDL
URL: https://github.com/apache/flink/pull/10468#discussion_r355161152
 
 

 ##########
 File path: 
flink-connectors/flink-connector-kafka-base/src/main/java/org/apache/flink/table/descriptors/KafkaValidator.java
 ##########
 @@ -134,4 +153,52 @@ public static String normalizeStartupMode(StartupMode 
startupMode) {
                }
                throw new IllegalArgumentException("Invalid startup mode.");
        }
+
+       /**
+        * Parse SpecificOffsets String to Map.
+        *
+        * <p>SpecificOffsets String format was given as following:
+        *
+        * <pre>
+        *     connector.specific-offsets = 
partition:0,offset:42;partition:1,offset:300
+        * </pre>
+        * @param descriptorProperties
+        * @return SpecificOffsets with map format, key is partition, and value 
is offset.
+        */
+       public static Map<Integer, Long> 
validateAndGetSpecificOffsetsStr(DescriptorProperties descriptorProperties) {
+               final Map<Integer, Long> offsetMap = new HashMap<>();
+
+               final String parseSpecificOffsetsStr = 
descriptorProperties.getString(CONNECTOR_SPECIFIC_OFFSETS);
+               if (parseSpecificOffsetsStr.isEmpty()) {
+                       throw new ValidationException("Properties '" + 
CONNECTOR_SPECIFIC_OFFSETS + "' can not be empty.");
+               }
 
 Review comment:
   Can use `descriptorProperties.validateString(CONNECTOR_SPECIFIC_OFFSETS, 
false, 1);`

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

Reply via email to