duhenglucky commented on a change in pull request #488: [ISSUE #487] Jdbc 
source connector support syncing data with white ta…
URL: https://github.com/apache/rocketmq-externals/pull/488#discussion_r357651922
 
 

 ##########
 File path: 
rocketmq-connect-jdbc/src/main/java/org/apache/rocketmq/connect/jdbc/source/Querier.java
 ##########
 @@ -132,19 +149,36 @@ public void poll()  {
 
     public void start() throws Exception {
         String whiteDataBases = config.getWhiteDataBase();
-        String whiteTables = config.getWhiteTable();
-
-        if (!StringUtils.isEmpty(whiteDataBases)) {
-            
Arrays.asList(whiteDataBases.trim().split(",")).forEach(whiteDataBase -> {
-                Collections.addAll(schema.dataBaseWhiteList, whiteDataBase);
-            });
+        JSONObject whiteDataBaseObject = 
JSONObject.parseObject(whiteDataBases);
+
+        if (whiteDataBaseObject != null){
+            for (String whiteDataBaseName : whiteDataBaseObject.keySet()){
+                JSONObject whiteTableObject = 
(JSONObject)whiteDataBaseObject.get(whiteDataBaseName);
+                HashSet<String> whiteTableSet = new HashSet<>();
+                for (String whiteTableName : whiteTableObject.keySet()){
+                    Collections.addAll(whiteTableSet, whiteTableName);
+                    HashMap<String, String> filterMap = new HashMap<>();
+                    JSONObject tableFilterObject = 
(JSONObject)whiteTableObject.get(whiteTableName);
+                    for(String filterKey : tableFilterObject.keySet()){
+                        filterMap.put(filterKey, 
tableFilterObject.getString(filterKey));
+                    }
+                    schema.tableFilterMap.put(whiteTableName, filterMap);
+                }
+                schema.dbTableMap.put(whiteDataBaseName, whiteTableSet);
+            }
         }
 
-        if (!StringUtils.isEmpty(whiteTables)) {
-            Arrays.asList(whiteTables.trim().split(",")).forEach(whiteTable -> 
{
-                Collections.addAll(schema.tableWhiteList, whiteTable);
-            });
-        }
+//        if (!StringUtils.isEmpty(whiteDataBases)) {
 
 Review comment:
   It would be better to remove these unused codes.

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