You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by vi...@apache.org on 2018/04/18 16:20:55 UTC

hive git commit: HIVE-19048 : Initscript errors are ignored (Bharathkrishna Guruvayoor Murali reviewed by Zoltan Haindrich and Vihang Karajgaonkar)

Repository: hive
Updated Branches:
  refs/heads/master 878d6ee05 -> 006bf8a1a


HIVE-19048 : Initscript errors are ignored (Bharathkrishna Guruvayoor Murali reviewed by Zoltan Haindrich and Vihang Karajgaonkar)


Project: http://git-wip-us.apache.org/repos/asf/hive/repo
Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/006bf8a1
Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/006bf8a1
Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/006bf8a1

Branch: refs/heads/master
Commit: 006bf8a1a49aabf9930744c977fb0b9c91a5ef6c
Parents: 878d6ee
Author: Bharathkrishna Guruvayoor Murali <bh...@cloudera.com>
Authored: Wed Apr 18 09:04:21 2018 -0700
Committer: Vihang Karajgaonkar <vi...@cloudera.com>
Committed: Wed Apr 18 09:04:21 2018 -0700

----------------------------------------------------------------------
 beeline/src/java/org/apache/hive/beeline/BeeLine.java  | 6 +++++-
 beeline/src/java/org/apache/hive/beeline/Commands.java | 9 ++++++++-
 2 files changed, 13 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hive/blob/006bf8a1/beeline/src/java/org/apache/hive/beeline/BeeLine.java
----------------------------------------------------------------------
diff --git a/beeline/src/java/org/apache/hive/beeline/BeeLine.java b/beeline/src/java/org/apache/hive/beeline/BeeLine.java
index 6f7f1fc..bdb65b1 100644
--- a/beeline/src/java/org/apache/hive/beeline/BeeLine.java
+++ b/beeline/src/java/org/apache/hive/beeline/BeeLine.java
@@ -798,6 +798,9 @@ public class BeeLine implements Closeable {
     if(!connSuccessful && !exit) {
       connSuccessful = defaultBeelineConnect(cl);
     }
+    if (exit) {
+      return 1;
+    }
 
     int code = 0;
     if (cl.getOptionValues('e') != null) {
@@ -1189,7 +1192,8 @@ public class BeeLine implements Closeable {
             }
           }
         } finally {
-          exit = false;
+          //exit beeline if there is initScript failure and --force is not set
+          exit = exitOnError && executionResult != ERRNO_OK;
         }
       }
     }

http://git-wip-us.apache.org/repos/asf/hive/blob/006bf8a1/beeline/src/java/org/apache/hive/beeline/Commands.java
----------------------------------------------------------------------
diff --git a/beeline/src/java/org/apache/hive/beeline/Commands.java b/beeline/src/java/org/apache/hive/beeline/Commands.java
index e46c0cf..4d654d4 100644
--- a/beeline/src/java/org/apache/hive/beeline/Commands.java
+++ b/beeline/src/java/org/apache/hive/beeline/Commands.java
@@ -1640,7 +1640,14 @@ public class Commands {
       if (!beeLine.isBeeLine()) {
         beeLine.updateOptsForCli();
       }
-      beeLine.runInit();
+
+      int initScriptExecutionResult = beeLine.runInit();
+
+      //if execution of the init script(s) return anything other than ERRNO_OK from beeline
+      //exit beeline with error unless --force is set
+      if(initScriptExecutionResult != 0 && !beeLine.getOpts().getForce()) {
+        return beeLine.error("init script execution failed.");
+      }
 
       beeLine.setCompletions();
       beeLine.getOpts().setLastConnectedUrl(url);