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

 ##########
 File path: 
flink-connectors/flink-connector-kafka-base/src/main/java/org/apache/flink/table/descriptors/KafkaValidator.java
 ##########
 @@ -134,4 +153,55 @@ 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
+        */
+       public static Map<Integer, Long> 
validateAndGetSpecificOffsetsStr(DescriptorProperties descriptorProperties) {
+               final Map<Integer, Long> offsetMap = new HashMap<>();
+
+               final String parseSpecificOffsetsStr = 
descriptorProperties.getString(CONNECTOR_SPECIFIC_OFFSETS);
+               if (null == parseSpecificOffsetsStr || 
parseSpecificOffsetsStr.length() == 0) {
+                       throw new ValidationException("Properties 
connector.specific-offsets can not be empty, but is:" + 
parseSpecificOffsetsStr);
+               }
+
+               final String[] pairs = parseSpecificOffsetsStr.split(";");
+               for (String pair: pairs) {
 
 Review comment:
   ok

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