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_r355160903
 
 

 ##########
 File path: 
flink-connectors/flink-connector-kafka-base/src/main/java/org/apache/flink/table/descriptors/Kafka.java
 ##########
 @@ -265,24 +259,22 @@ public Kafka sinkPartitionerCustom(Class<? extends 
FlinkKafkaPartitioner> partit
                }
 
                if (specificOffsets != null) {
-                       final List<List<String>> values = new ArrayList<>();
+                       final StringBuilder stringBuilder = new StringBuilder();
+                       int i = 0;
                        for (Map.Entry<Integer, Long> specificOffset : 
specificOffsets.entrySet()) {
-                               
values.add(Arrays.asList(specificOffset.getKey().toString(), 
specificOffset.getValue().toString()));
+                               if (i != 0) {
+                                       stringBuilder.append(';');
+                               }
+                               
stringBuilder.append(CONNECTOR_SPECIFIC_OFFSETS_PARTITION).append(':').append(specificOffset.getKey()).append(',');
+                               
stringBuilder.append(CONNECTOR_SPECIFIC_OFFSETS_OFFSET).append(':').append(specificOffset.getValue());
+                               i++;
                        }
-                       properties.putIndexedFixedProperties(
-                               CONNECTOR_SPECIFIC_OFFSETS,
-                               
Arrays.asList(CONNECTOR_SPECIFIC_OFFSETS_PARTITION, 
CONNECTOR_SPECIFIC_OFFSETS_OFFSET),
-                               values);
+                       properties.putString(CONNECTOR_SPECIFIC_OFFSETS, 
stringBuilder.toString());
                }
 
                if (kafkaProperties != null) {
-                       properties.putIndexedFixedProperties(
-                               CONNECTOR_PROPERTIES,
-                               Arrays.asList(CONNECTOR_PROPERTIES_KEY, 
CONNECTOR_PROPERTIES_VALUE),
-                               this.kafkaProperties.entrySet().stream()
-                                       .map(e -> Arrays.asList(e.getKey(), 
e.getValue()))
-                                       .collect(Collectors.toList())
-                               );
+                       this.kafkaProperties.entrySet().forEach(entry ->
+                                                       
properties.putString(CONNECTOR_PROPERTIES + '.' + entry.getKey(), 
entry.getValue()));
 
 Review comment:
   simplify to 
   
   ```java
   this.kafkaProperties.forEach((key, value) ->
       properties.putString(CONNECTOR_PROPERTIES + '.' + key, value));
   ```

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