You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dolphinscheduler.apache.org by "ruanwenjun (via GitHub)" <gi...@apache.org> on 2026/02/13 01:58:32 UTC

[PR] [Fix-17971] Fix local parameter defined in ProcedureTask not being passed correctly [dolphinscheduler]

ruanwenjun opened a new pull request, #17973:
URL: https://github.com/apache/dolphinscheduler/pull/17973

   <!--Thanks very much for contributing to Apache DolphinScheduler, we are happy that you want to help us improve DolphinScheduler! -->
   
   ## Purpose of the pull request
   
   close #17971 
   
   ## Brief change log
   
   
   After ProcedureTask successed, merge the varpool with local param.
   
   ## Verify this pull request
   
   <!--*(Please pick either of the following options)*-->
   
   This pull request is code cleanup without any test coverage.
   
   *(or)*
   
   This pull request is already covered by existing tests, such as *(please describe tests)*.
   
   (or)
   
   This change added tests and can be verified as follows:
   
   <!--*(example:)*
   - *Added dolphinscheduler-dao tests for end-to-end.*
   - *Added CronUtilsTest to verify the change.*
   - *Manually verified the change by testing locally.* -->
   
   (or)
   
   ## Pull Request Notice
   [Pull Request Notice](https://github.com/apache/dolphinscheduler/blob/dev/docs/docs/en/contribute/join/pull-request.md)
   
   If your pull request contains incompatible change, you should also add it to `docs/docs/en/guide/upgrade/incompatible.md`
   


-- 
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: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Fix-17971] Fix ProcedureTask can not pass out parameter and can not execute query procedure. [dolphinscheduler]

Posted by "Mrhs121 (via GitHub)" <gi...@apache.org>.
Mrhs121 commented on PR #17973:
URL: https://github.com/apache/dolphinscheduler/pull/17973#issuecomment-3903143928

   LGTM


-- 
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: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Fix-17971] Fix ProcedureTask can not pass out parameter and can not execute query procedure. [dolphinscheduler]

Posted by "njnu-seafish (via GitHub)" <gi...@apache.org>.
njnu-seafish commented on PR #17973:
URL: https://github.com/apache/dolphinscheduler/pull/17973#issuecomment-3906492943

   LGTM


-- 
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: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Fix-17971] Fix ProcedureTask can not pass out parameter and can not execute query procedure. [dolphinscheduler]

Posted by "Mrhs121 (via GitHub)" <gi...@apache.org>.
Mrhs121 commented on code in PR #17973:
URL: https://github.com/apache/dolphinscheduler/pull/17973#discussion_r2808435290


##########
dolphinscheduler-task-plugin/dolphinscheduler-task-procedure/src/main/java/org/apache/dolphinscheduler/plugin/task/procedure/ProcedureTask.java:
##########
@@ -154,59 +161,50 @@ public void cancel() throws TaskException {
         }
     }
 
-    private String formatSql(Map<Integer, Property> sqlParamsMap, Map<String, Property> paramsMap) {
-        setSqlParamsMap(procedureParameters.getMethod(), sqlParamsMap, paramsMap,
-                taskExecutionContext.getTaskInstanceId());
-        return procedureParameters.getMethod().replaceAll(TaskConstants.SQL_PARAMS_REGEX, "?");
-    }
-
-    /**
-     * print outParameter
-     *
-     * @param stmt            CallableStatement
-     * @param outParameterMap outParameterMap
-     * @throws SQLException SQLException
-     */
-    private void printOutParameter(CallableStatement stmt,
-                                   Map<Integer, Property> outParameterMap) throws SQLException {
-        for (Map.Entry<Integer, Property> en : outParameterMap.entrySet()) {
-            int index = en.getKey();
-            Property property = en.getValue();
+    // parse the out parameter from stmt and put them into varPool
+    private Map<String, String> parseOutParameters(CallableStatement stmt,
+                                                   Map<Integer, Property> sqlOutPlaceHolders) throws SQLException {
+        Map<String, String> sqlOutParameters = new HashMap<>();
+        for (Map.Entry<Integer, Property> out : sqlOutPlaceHolders.entrySet()) {
+            int index = out.getKey();
+            Property property = out.getValue();
             String prop = property.getProp();
             DataType dataType = property.getType();
             // get output parameter
-            procedureParameters.dealOutParam4Procedure(getOutputParameter(stmt, index, prop, dataType), prop);
+            Object outputParameterValue = getOutputParameter(stmt, index, prop, dataType);
+            sqlOutParameters.put(prop, String.valueOf(outputParameterValue));
         }
+        return sqlOutParameters;
     }
 
     /**
      * get output parameter
      *
      * @param stmt      CallableStatement
-     * @param paramsMap paramsMap
+     * @param sqlParams paramsMap
      * @return outParameterMap
      * @throws Exception Exception
      */
-    private Map<Integer, Property> getOutParameterMap(CallableStatement stmt, Map<Integer, Property> paramsMap,
-                                                      Map<String, Property> totalParamsMap) throws Exception {
+    private Map<Integer, Property> assemblySqlPlaceHolder(CallableStatement stmt,
+                                                          Map<Integer, Property> sqlParams,
+                                                          Map<String, Property> prepareParams) throws Exception {
         Map<Integer, Property> outParameterMap = new HashMap<>();
-        if (procedureParameters.getLocalParametersMap() == null) {
+        if (MapUtils.isEmpty(sqlParams)) {

Review Comment:
   https://github.com/apache/dolphinscheduler/issues/17971 @honkerjha The key fix to solve this issue
   



-- 
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: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Fix-17971] Fix local parameter defined in ProcedureTask not being passed correctly [dolphinscheduler]

Posted by "ruanwenjun (via GitHub)" <gi...@apache.org>.
ruanwenjun commented on PR #17973:
URL: https://github.com/apache/dolphinscheduler/pull/17973#issuecomment-3894481511

   @Mrhs121 Please take a look.


-- 
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: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Fix-17971] Fix ProcedureTask can not pass out parameter and can not execute query procedure. [dolphinscheduler]

Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #17973:
URL: https://github.com/apache/dolphinscheduler/pull/17973#issuecomment-3945268906

   ## [![Quality Gate Failed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/qg-failed-20px.png 'Quality Gate Failed')](https://sonarcloud.io/dashboard?id=apache-dolphinscheduler&pullRequest=17973) **Quality Gate failed**  
   Failed conditions  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/failed-16px.png '') [17.6% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=17973&metric=new_coverage&view=list) (required ≥ 60%)  
     
   [See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache-dolphinscheduler&pullRequest=17973)
   
   


-- 
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: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Fix-17971] Fix ProcedureTask can not pass out parameter and can not execute query procedure. [dolphinscheduler]

Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #17973:
URL: https://github.com/apache/dolphinscheduler/pull/17973#issuecomment-3959412889

   ## [![Quality Gate Failed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/qg-failed-20px.png 'Quality Gate Failed')](https://sonarcloud.io/dashboard?id=apache-dolphinscheduler&pullRequest=17973) **Quality Gate failed**  
   Failed conditions  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/failed-16px.png '') [18.4% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=17973&metric=new_coverage&view=list) (required ≥ 60%)  
     
   [See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache-dolphinscheduler&pullRequest=17973)
   
   


-- 
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: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Fix-17971] Fix ProcedureTask can not pass out parameter and can not execute query procedure. [dolphinscheduler]

Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #17973:
URL: https://github.com/apache/dolphinscheduler/pull/17973#issuecomment-3959428879

   ## [![Quality Gate Failed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/qg-failed-20px.png 'Quality Gate Failed')](https://sonarcloud.io/dashboard?id=apache-dolphinscheduler&pullRequest=17973) **Quality Gate failed**  
   Failed conditions  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/failed-16px.png '') [18.4% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=17973&metric=new_coverage&view=list) (required ≥ 60%)  
     
   [See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache-dolphinscheduler&pullRequest=17973)
   
   


-- 
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: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Fix-17971] Fix ProcedureTask can not pass out parameter and can not execute query procedure. [dolphinscheduler]

Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #17973:
URL: https://github.com/apache/dolphinscheduler/pull/17973#issuecomment-3945260510

   ## [![Quality Gate Failed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/qg-failed-20px.png 'Quality Gate Failed')](https://sonarcloud.io/dashboard?id=apache-dolphinscheduler&pullRequest=17973) **Quality Gate failed**  
   Failed conditions  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/failed-16px.png '') [17.6% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache-dolphinscheduler&pullRequest=17973&metric=new_coverage&view=list) (required ≥ 60%)  
     
   [See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache-dolphinscheduler&pullRequest=17973)
   
   


-- 
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: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org