curcur commented on a change in pull request #11725:
URL: https://github.com/apache/flink/pull/11725#discussion_r418541284



##########
File path: flink-core/src/main/java/org/apache/flink/util/PropertiesUtil.java
##########
@@ -108,6 +109,27 @@ public static boolean getBoolean(Properties config, String 
key, boolean defaultV
                }
        }
 
+       /**
+        * Flatten a recursive {@link Properties} to a first level property map.
+        * In some cases, {KafkaProducer#propsToMap} for example, Properties is 
used purely as a HashMap
+        * without considering its default properties.
+        *
+        * @param config Properties to be flatten
+        * @return Properties without defaults; all properties are put in the 
first-level
+        */
+       public static Properties flatten(Properties config) {

Review comment:
       > On a second thought, wouldn't it make more sense to provide a correct 
`propsToMap` implementation? If it's only used in KafkaProducer, then we could 
fix it there. If not, I'd consider that function more useful than this 
`flatten`.
   
   this name is still confusing since it is a Properties, not a map.
   
   The flattened properties are actually used in the Kafka client lib, not that 
easy to fix.
   

##########
File path: flink-core/src/main/java/org/apache/flink/util/PropertiesUtil.java
##########
@@ -108,6 +109,27 @@ public static boolean getBoolean(Properties config, String 
key, boolean defaultV
                }
        }
 
+       /**
+        * Flatten a recursive {@link Properties} to a first level property map.
+        * In some cases, {KafkaProducer#propsToMap} for example, Properties is 
used purely as a HashMap
+        * without considering its default properties.
+        *
+        * @param config Properties to be flatten
+        * @return Properties without defaults; all properties are put in the 
first-level
+        */
+       public static Properties flatten(Properties config) {

Review comment:
       > Should be covered with one test case.
   
   sure, will add one later.




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


Reply via email to