You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dolphinscheduler.apache.org by lg...@apache.org on 2020/04/15 09:39:21 UTC

[incubator-dolphinscheduler] branch dev updated: Solve the failure to execute non-query sql (#2413)

This is an automated email from the ASF dual-hosted git repository.

lgcareer pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/incubator-dolphinscheduler.git


The following commit(s) were added to refs/heads/dev by this push:
     new f218370  Solve the failure to execute non-query sql (#2413)
f218370 is described below

commit f21837076e0647103fc901e604013d0e21139460
Author: zixi0825 <64...@qq.com>
AuthorDate: Wed Apr 15 17:39:12 2020 +0800

    Solve the failure to execute non-query sql (#2413)
    
    Co-authored-by: sunchaohe <su...@linklogis.com>
    Co-authored-by: qiaozhanwei <qi...@outlook.com>
    Co-authored-by: lgcareer <18...@163.com>
---
 .../apache/dolphinscheduler/server/worker/task/sql/SqlTask.java   | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/sql/SqlTask.java b/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/sql/SqlTask.java
index 61d9325..22fa91d 100644
--- a/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/sql/SqlTask.java
+++ b/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/sql/SqlTask.java
@@ -214,11 +214,8 @@ public class SqlTask extends AbstractTask {
         try {
             // if upload resource is HDFS and kerberos startup
             CommonUtils.loadKerberosConf();
-
-
             // create connection
             connection = createConnection();
-
             // create temp function
             if (CollectionUtils.isNotEmpty(createFuncs)) {
                 createTempFunction(connection,createFuncs);
@@ -226,13 +223,12 @@ public class SqlTask extends AbstractTask {
 
             // pre sql
             preSql(connection,preStatementsBinds);
-
-
             stmt = prepareStatementAndBind(connection, mainSqlBinds);
-            resultSet = stmt.executeQuery();
+
             // decide whether to executeQuery or executeUpdate based on sqlType
             if (sqlParameters.getSqlType() == SqlType.QUERY.ordinal()) {
                 // query statements need to be convert to JsonArray and inserted into Alert to send
+                resultSet = stmt.executeQuery();
                 resultProcess(resultSet);
 
             } else if (sqlParameters.getSqlType() == SqlType.NON_QUERY.ordinal()) {