tajo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jihoon...@apache.org
Subject tajo git commit: TAJO-1576: Sometimes DefaultTajoCliOutputFormatter.parseErrorMessage() eliminates an important kind of information.
Date Fri, 08 May 2015 06:12:34 GMT
Repository: tajo
Updated Branches:
  refs/heads/branch-0.10.1 9d331f9af -> 556498f58


TAJO-1576: Sometimes DefaultTajoCliOutputFormatter.parseErrorMessage() eliminates an important
kind of information.

Signed-off-by: Jihoon Son <jihoonson@apache.org>


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

Branch: refs/heads/branch-0.10.1
Commit: 556498f58451c9f17c1e734390c159fdf41b88b4
Parents: 9d331f9
Author: Jongyoung Park <eminency@gmail.com>
Authored: Fri May 8 15:12:15 2015 +0900
Committer: Jihoon Son <jihoonson@apache.org>
Committed: Fri May 8 15:12:15 2015 +0900

----------------------------------------------------------------------
 CHANGES                                                |  4 ++++
 .../tajo/cli/tsql/DefaultTajoCliOutputFormatter.java   |  4 +---
 .../tajo/cli/tsql/TestDefaultCliOutputFormatter.java   | 13 +++++++++----
 3 files changed, 14 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tajo/blob/556498f5/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index de1144e..47af73b 100644
--- a/CHANGES
+++ b/CHANGES
@@ -9,6 +9,10 @@ Release 0.10.1 - unreleased
 
   IMPROVEMENT
 
+    TAJO-1576: Sometimes DefaultTajoCliOutputFormatter.parseErrorMessage() eliminates
+    an important kind of information.
+    (Contributed by Jongyoung Park, Committed by jihoon)
+
     TAJO-1381: Support multi-bytes delimiter for Text file.
     (Contributed by navis, Committed by jinho)
   

http://git-wip-us.apache.org/repos/asf/tajo/blob/556498f5/tajo-cli/src/main/java/org/apache/tajo/cli/tsql/DefaultTajoCliOutputFormatter.java
----------------------------------------------------------------------
diff --git a/tajo-cli/src/main/java/org/apache/tajo/cli/tsql/DefaultTajoCliOutputFormatter.java
b/tajo-cli/src/main/java/org/apache/tajo/cli/tsql/DefaultTajoCliOutputFormatter.java
index 5cbe77b..33624e5 100644
--- a/tajo-cli/src/main/java/org/apache/tajo/cli/tsql/DefaultTajoCliOutputFormatter.java
+++ b/tajo-cli/src/main/java/org/apache/tajo/cli/tsql/DefaultTajoCliOutputFormatter.java
@@ -196,10 +196,8 @@ public class DefaultTajoCliOutputFormatter implements TajoCliOutputFormatter
{
     if (message == null) {
       return TajoCli.ERROR_PREFIX + "No error message";
     }
-    String[] lines = message.split("\n");
-    message = lines[0];
 
-    int index = message.lastIndexOf(TajoCli.ERROR_PREFIX);
+    int index = message.indexOf(TajoCli.ERROR_PREFIX);
     if (index < 0) {
       message = TajoCli.ERROR_PREFIX + message;
     } else {

http://git-wip-us.apache.org/repos/asf/tajo/blob/556498f5/tajo-core/src/test/java/org/apache/tajo/cli/tsql/TestDefaultCliOutputFormatter.java
----------------------------------------------------------------------
diff --git a/tajo-core/src/test/java/org/apache/tajo/cli/tsql/TestDefaultCliOutputFormatter.java
b/tajo-core/src/test/java/org/apache/tajo/cli/tsql/TestDefaultCliOutputFormatter.java
index df709c5..d0e4341 100644
--- a/tajo-core/src/test/java/org/apache/tajo/cli/tsql/TestDefaultCliOutputFormatter.java
+++ b/tajo-core/src/test/java/org/apache/tajo/cli/tsql/TestDefaultCliOutputFormatter.java
@@ -101,13 +101,19 @@ public class TestDefaultCliOutputFormatter {
         "\tat org.apache.tajo.rpc.ServerCallable.withRetries(ServerCallable.java:97)\n" +
         "\t... 6 more";
 
-    assertEquals("ERROR: no such a table: table1", DefaultTajoCliOutputFormatter.parseErrorMessage(multiLineMessage));
+    assertEquals(multiLineMessage, DefaultTajoCliOutputFormatter.parseErrorMessage(multiLineMessage));
+
+    String noPrefixMessage = "RTFM please";
+    assertEquals("ERROR: "+noPrefixMessage, DefaultTajoCliOutputFormatter.parseErrorMessage(noPrefixMessage));
+
+    String errorMessageWithLine = "ERROR: syntax error at or near '('\n" +
+        "LINE 1:7 select (*) from tc\n" +
+        "                ^";
+    assertEquals(errorMessageWithLine, DefaultTajoCliOutputFormatter.parseErrorMessage(errorMessageWithLine));
   }
 
   @Test
   public void testPrintResultInsertStatement() throws Exception {
-
-
     DefaultTajoCliOutputFormatter outputFormatter = new DefaultTajoCliOutputFormatter();
     outputFormatter.init(cliContext);
 
@@ -176,5 +182,4 @@ public class TestDefaultCliOutputFormatter {
 
     assertEquals(expectedOutput, stringWriter.toString());
   }
-
 }


Mime
View raw message