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:10:41 GMT
Repository: tajo
Updated Branches:
  refs/heads/master 2b4c1610d -> e6e1860c8


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

Closes #561

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/e6e1860c
Tree: http://git-wip-us.apache.org/repos/asf/tajo/tree/e6e1860c
Diff: http://git-wip-us.apache.org/repos/asf/tajo/diff/e6e1860c

Branch: refs/heads/master
Commit: e6e1860c8e83f9db6c4c094fe703b21d45d86529
Parents: 2b4c161
Author: Jongyoung Park <eminency@gmail.com>
Authored: Fri May 8 15:10:09 2015 +0900
Committer: Jihoon Son <jihoonson@apache.org>
Committed: Fri May 8 15:10:09 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/e6e1860c/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index d448c09..15fc494 100644
--- a/CHANGES
+++ b/CHANGES
@@ -24,6 +24,10 @@ Release 0.11.0 - unreleased
 
   IMPROVEMENT
 
+    TAJO-1576: Sometimes DefaultTajoCliOutputFormatter.parseErrorMessage() eliminates 
+    an important kind of information. 
+    (Contributed by Jongyoung Park, Committed by jihoon)
+
     TAJO-1408: Make IntermediateEntryProto more compact. 
     (Contributed by navis, Committed by hyunsik)
 

http://git-wip-us.apache.org/repos/asf/tajo/blob/e6e1860c/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 aaa411e..03aa4cc 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/e6e1860c/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 0bb11e0..f6dcaec 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
@@ -97,13 +97,19 @@ public class TestDefaultCliOutputFormatter {
         "Caused by: java.sql.SQLException: ERROR: no such a table: table1\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);
 
@@ -172,5 +178,4 @@ public class TestDefaultCliOutputFormatter {
 
     assertEquals(expectedOutput, stringWriter.toString());
   }
-
 }


Mime
View raw message