zhongjiajie commented on code in PR #15551:
URL: 
https://github.com/apache/dolphinscheduler/pull/15551#discussion_r1473915243


##########
dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/utils/JdbcUrlParser.java:
##########
@@ -105,8 +109,24 @@ public static JdbcInfo getJdbcInfo(String jdbcUrl) {
         jdbcInfo.setHost(host);
         jdbcInfo.setPort(port);
         jdbcInfo.setDatabase(database);
-        jdbcInfo.setParams(params);
-        jdbcInfo.setAddress("jdbc:" + driverName + "://" + host + COLON + 
port);
+
+        if (StringUtils.isNotEmpty(params)) {
+            Map<String, String> others = new HashMap<>();
+            String[] paramList = params.split("&");
+            for (String param : paramList) {
+                // handle bad params
+                if (StringUtils.isEmpty(param) || !param.contains(EQUAL_SIGN)) 
{
+                    continue;
+                }
+                String[] kv = param.split(EQUAL_SIGN);
+                others.put(kv[0], kv[1]);
+            }
+            jdbcInfo.setParams(others);
+        }

Review Comment:
   parse metadata other param to avoid connect error



##########
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/TaskExecutionContextFactory.java:
##########
@@ -400,15 +394,16 @@ public DataSource getDefaultDataSource() {
         dataSource.setUserName(hikariDataSource.getUsername());
         JdbcInfo jdbcInfo = 
JdbcUrlParser.getJdbcInfo(hikariDataSource.getJdbcUrl());
         if (jdbcInfo != null) {
-            Properties properties = new Properties();
-            properties.setProperty(USER, hikariDataSource.getUsername());
-            properties.setProperty(PASSWORD, hikariDataSource.getPassword());
-            properties.setProperty(DATABASE, jdbcInfo.getDatabase());
-            properties.setProperty(ADDRESS, jdbcInfo.getAddress());
-            properties.setProperty(OTHER, jdbcInfo.getParams());
-            properties.setProperty(JDBC_URL, jdbcInfo.getAddress() + 
SINGLE_SLASH + jdbcInfo.getDatabase());
+            //
+            BaseConnectionParam baseConnectionParam = new 
DefaultConnectionParam();
+            baseConnectionParam.setUser(hikariDataSource.getUsername());
+            baseConnectionParam.setPassword(hikariDataSource.getPassword());
+            baseConnectionParam.setDatabase(jdbcInfo.getDatabase());
+            baseConnectionParam.setAddress(jdbcInfo.getAddress());
+            baseConnectionParam.setJdbcUrl(jdbcInfo.getJdbcUrl());
+            baseConnectionParam.setOther(jdbcInfo.getParams());

Review Comment:
   key change for data quality task can not be use



##########
dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/utils/CommonUtils.java:
##########
@@ -123,14 +132,56 @@ public static boolean loadKerberosConf(String 
javaSecurityKrb5Conf, String login
         return false;
     }
 
-    public static String getDataQualityJarName() {
-        String dqsJarName = PropertyUtils.getString(DATA_QUALITY_JAR_NAME);
+    public static String getDataQualityJarPath() {
+        String dqsJarPath = PropertyUtils.getString(DATA_QUALITY_JAR_NAME);
 
-        if (StringUtils.isEmpty(dqsJarName)) {
-            return "dolphinscheduler-data-quality.jar";
+        if (StringUtils.isEmpty(dqsJarPath)) {
+            log.info("data quality jar path is empty, will try to get it from 
data quality jar name");
+            return getDefaultDataQualityJarPath();
         }
 
-        return dqsJarName;
+        return dqsJarPath;
+    }
+
+    private static String getDefaultDataQualityJarPath() {
+        if (StringUtils.isNotEmpty(DEFAULT_DATA_QUALITY_JAR_PATH)) {
+            return DEFAULT_DATA_QUALITY_JAR_PATH;
+        }
+        try {
+            // not standalone mode
+            String currentAbsolutePath = new 
ClassPathResource("./").getFile().getAbsolutePath();
+            String currentLibPath = currentAbsolutePath + "/../libs";
+            getDataQualityJarPathFromPath(currentLibPath).ifPresent(jarName -> 
DEFAULT_DATA_QUALITY_JAR_PATH = jarName);
+
+            // standalone mode

Review Comment:
   auto discovery data quality jar path for both standalone mode and not



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

Reply via email to