You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@linkis.apache.org by ca...@apache.org on 2023/03/14 06:42:27 UTC

[linkis] branch dev-1.3.2 updated: Fix hive-3.1.2 IDriver NoSuchMethod run (string,boolean) #4361 (#4362)

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

casion pushed a commit to branch dev-1.3.2
in repository https://gitbox.apache.org/repos/asf/linkis.git


The following commit(s) were added to refs/heads/dev-1.3.2 by this push:
     new b0e7f23af Fix hive-3.1.2 IDriver NoSuchMethod run (string,boolean) #4361 (#4362)
b0e7f23af is described below

commit b0e7f23afa1c0aacf862b21b5a9deb8f97d77368
Author: peacewong <wp...@gmail.com>
AuthorDate: Tue Mar 14 14:42:19 2023 +0800

    Fix hive-3.1.2 IDriver NoSuchMethod run (string,boolean) #4361 (#4362)
---
 .../hive/executor/HiveEngineConnExecutor.scala     | 67 ++++++++++++----------
 1 file changed, 36 insertions(+), 31 deletions(-)

diff --git a/linkis-engineconn-plugins/hive/src/main/scala/org/apache/linkis/engineplugin/hive/executor/HiveEngineConnExecutor.scala b/linkis-engineconn-plugins/hive/src/main/scala/org/apache/linkis/engineplugin/hive/executor/HiveEngineConnExecutor.scala
index 1a1da03cc..d73cd9a6c 100644
--- a/linkis-engineconn-plugins/hive/src/main/scala/org/apache/linkis/engineplugin/hive/executor/HiveEngineConnExecutor.scala
+++ b/linkis-engineconn-plugins/hive/src/main/scala/org/apache/linkis/engineplugin/hive/executor/HiveEngineConnExecutor.scala
@@ -199,38 +199,43 @@ class HiveEngineConnExecutor(
       driver.setTryCount(tryCount + 1)
       val startTime = System.currentTimeMillis()
       try {
-        var compileRet = -1
-        Utils.tryCatch {
-          compileRet = driver.compile(realCode)
-          logger.info(s"driver compile realCode : ${realCode} finished, status : ${compileRet}")
-          if (0 != compileRet) {
-            logger.warn(s"compile realCode : ${realCode} error status : ${compileRet}")
-            throw HiveQueryFailedException(
-              COMPILE_HIVE_QUERY_ERROR.getErrorCode,
-              COMPILE_HIVE_QUERY_ERROR.getErrorDesc
-            )
+        val hiveResponse: CommandProcessorResponse =
+          if (!HiveDriverProxy.isIDriver(driver.getDriver())) {
+            var compileRet = -1
+            Utils.tryCatch {
+              compileRet = driver.compile(realCode)
+              logger.info(s"driver compile realCode : ${realCode} finished, status : ${compileRet}")
+              if (0 != compileRet) {
+                logger.warn(s"compile realCode : ${realCode} error status : ${compileRet}")
+                throw HiveQueryFailedException(
+                  COMPILE_HIVE_QUERY_ERROR.getErrorCode,
+                  COMPILE_HIVE_QUERY_ERROR.getErrorDesc
+                )
+              }
+              val queryPlan = driver.getPlan()
+              val numberOfJobs = Utilities.getMRTasks(queryPlan.getRootTasks).size
+              numberOfMRJobs = numberOfJobs
+              logger.info(s"there are ${numberOfMRJobs} jobs.")
+            } {
+              case e: Exception => logger.warn("obtain hive execute query plan failed,", e)
+              case t: Throwable => logger.warn("obtain hive execute query plan failed,", t)
+            }
+            if (numberOfMRJobs > 0) {
+              engineExecutorContext.appendStdout(s"Your hive sql has $numberOfMRJobs MR jobs to do")
+            }
+            if (thread.isInterrupted) {
+              logger.error(
+                "The thread of execution has been interrupted and the task should be terminated"
+              )
+              return ErrorExecuteResponse(
+                "The thread of execution has been interrupted and the task should be terminated",
+                null
+              )
+            }
+            driver.run(realCode, compileRet == 0)
+          } else {
+            driver.run(realCode)
           }
-          val queryPlan = driver.getPlan()
-          val numberOfJobs = Utilities.getMRTasks(queryPlan.getRootTasks).size
-          numberOfMRJobs = numberOfJobs
-          logger.info(s"there are ${numberOfMRJobs} jobs.")
-        } {
-          case e: Exception => logger.warn("obtain hive execute query plan failed,", e)
-          case t: Throwable => logger.warn("obtain hive execute query plan failed,", t)
-        }
-        if (numberOfMRJobs > 0) {
-          engineExecutorContext.appendStdout(s"Your hive sql has $numberOfMRJobs MR jobs to do")
-        }
-        if (thread.isInterrupted) {
-          logger.error(
-            "The thread of execution has been interrupted and the task should be terminated"
-          )
-          return ErrorExecuteResponse(
-            "The thread of execution has been interrupted and the task should be terminated",
-            null
-          )
-        }
-        val hiveResponse: CommandProcessorResponse = driver.run(realCode, compileRet == 0)
         if (hiveResponse.getResponseCode != 0) {
           LOG.error("Hive query failed, response code is {}", hiveResponse.getResponseCode)
           return ErrorExecuteResponse(hiveResponse.getErrorMessage, hiveResponse.getException)


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@linkis.apache.org
For additional commands, e-mail: commits-help@linkis.apache.org