tajo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hyun...@apache.org
Subject tajo git commit: TAJO-1183: Keep command execution even with errors. (Jaewoong Jung via hyunsik)
Date Wed, 03 Dec 2014 06:33:49 GMT
Repository: tajo
Updated Branches:
  refs/heads/master 1cdbe467e -> 5066ac3e8


TAJO-1183: Keep command execution even with errors. (Jaewoong Jung via hyunsik)

Closes #266


Project: http://git-wip-us.apache.org/repos/asf/tajo/repo
Commit: http://git-wip-us.apache.org/repos/asf/tajo/commit/5066ac3e
Tree: http://git-wip-us.apache.org/repos/asf/tajo/tree/5066ac3e
Diff: http://git-wip-us.apache.org/repos/asf/tajo/diff/5066ac3e

Branch: refs/heads/master
Commit: 5066ac3e80da390ff0f5733d345cbc63ec252843
Parents: 1cdbe46
Author: Hyunsik Choi <hyunsik@apache.org>
Authored: Wed Dec 3 15:30:16 2014 +0900
Committer: Hyunsik Choi <hyunsik@apache.org>
Committed: Wed Dec 3 15:32:16 2014 +0900

----------------------------------------------------------------------
 CHANGES                                                |  3 +++
 .../main/java/org/apache/tajo/cli/tsql/TajoCli.java    | 13 +++++++------
 2 files changed, 10 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tajo/blob/5066ac3e/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index 188e024..c03b72b 100644
--- a/CHANGES
+++ b/CHANGES
@@ -80,6 +80,9 @@ Release 0.9.1 - unreleased
 
   BUG FIXES
 
+    TAJO-1183: Keep command execution even with errors. (Jaewoong Jung via 
+    hyunsik)
+
     TAJO-1190: INSERT INTO to partition tables may cause NPE. (hyunsik)
 
     TAJO-1211: Staging directory for CTAS and INSERT should be in 

http://git-wip-us.apache.org/repos/asf/tajo/blob/5066ac3e/tajo-client/src/main/java/org/apache/tajo/cli/tsql/TajoCli.java
----------------------------------------------------------------------
diff --git a/tajo-client/src/main/java/org/apache/tajo/cli/tsql/TajoCli.java b/tajo-client/src/main/java/org/apache/tajo/cli/tsql/TajoCli.java
index e96017b..d4886cf 100644
--- a/tajo-client/src/main/java/org/apache/tajo/cli/tsql/TajoCli.java
+++ b/tajo-client/src/main/java/org/apache/tajo/cli/tsql/TajoCli.java
@@ -390,7 +390,7 @@ public class TajoCli {
   public int runShell() throws Exception {
     String line;
     String currentPrompt = context.getCurrentDatabase();
-    int exitCode = 0;
+    int exitCode;
 
     sout.write("Try \\? for help.\n");
 
@@ -416,7 +416,8 @@ public class TajoCli {
           exitCode = executeParsedResults(parsedResults);
           currentPrompt = updatePrompt(parser.getState());
 
-          if (exitCode != 0 && context.getBool(SessionVars.ON_ERROR_STOP)) {
+          // if at least one failed
+          if (exitCode != 0) {
             return exitCode;
           }
         }
@@ -430,11 +431,11 @@ public class TajoCli {
       
       throw e;
     }
-    return exitCode;
+    return 0;
   }
 
   private int executeParsedResults(Collection<ParsedResult> parsedResults) throws Exception
{
-    int exitCode = 0;
+    int exitCode;
     for (ParsedResult parsedResult : parsedResults) {
       if (parsedResult.getType() == META) {
         exitCode = executeMetaCommand(parsedResult.getStatement());
@@ -442,12 +443,12 @@ public class TajoCli {
         exitCode = executeQuery(parsedResult.getStatement());
       }
 
-      if (exitCode != 0) {
+      if (exitCode != 0 && context.getBool(SessionVars.ON_ERROR_STOP)) {
         return exitCode;
       }
     }
 
-    return exitCode;
+    return 0;
   }
 
   public int executeMetaCommand(String line) throws Exception {


Mime
View raw message