mustajibmk commented on code in PR #15408:
URL: https://github.com/apache/druid/pull/15408#discussion_r1429782993


##########
processing/src/main/java/org/apache/druid/utils/ConnectionUriUtils.java:
##########
@@ -177,19 +178,26 @@ public static Set<String> 
tryParsePostgresConnectionUri(String connectionUri)
   }
 
   public static Set<String> tryParseMySqlConnectionUri(String connectionUri)
-      throws ClassNotFoundException, NoSuchMethodException, 
InstantiationException, IllegalAccessException,
+      throws ClassNotFoundException, NoSuchMethodException, 
IllegalAccessException,
              InvocationTargetException
   {
-    Class<?> driverClass = Class.forName(MYSQL_NON_REGISTERING_DRIVER);
-    Method parseUrl = driverClass.getMethod("parseURL", String.class, 
Properties.class);
-    // almost the same as postgres, but is an instance level method
-    Properties properties = (Properties) parseUrl.invoke(
-        driverClass.getConstructor().newInstance(),
-        connectionUri,
-        null
-    );
-
-    if (properties == null) {
+    Class<?> connectionUrlParserClass = 
Class.forName(MYSQL_CJ_CONF_CONNECTION_URL_PARSER);
+    Method parseUrl = 
connectionUrlParserClass.getMethod("parseConnectionString", String.class);
+    // almost the same as postgres
+    Object connectionUrlParser = parseUrl.invoke(null, connectionUri);
+    Method getProperties = connectionUrlParserClass.getMethod("getProperties");
+    Properties properties = new Properties();
+    Map<String,String> propertyMap =  (Map<String, String>) 
getProperties.invoke(connectionUrlParser);
+    for (Map.Entry<String, String> entry : propertyMap.entrySet()) {
+      if (entry.getKey() != null) {
+        if(entry.getValue() == null) {

Review Comment:
   Yes, it is possible. Like in this 
[case](https://github.com/apache/druid/blob/e373f6269251655f5be93ce895aee8dee8cc67dd/processing/src/test/java/org/apache/druid/utils/ConnectionUriUtilsTest.java#L42)
 where `keyonly` doesn't have any value associated with it.



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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to