hive-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From na...@apache.org
Subject svn commit: r1460990 - in /hive/trunk/ql/src/test: org/apache/hadoop/hive/ql/QTestUtil.java queries/clientpositive/semicolon.q results/clientpositive/semicolon.q.out
Date Tue, 26 Mar 2013 06:53:17 GMT
Author: namit
Date: Tue Mar 26 06:53:16 2013
New Revision: 1460990

URL: http://svn.apache.org/r1460990
Log:
HIVE-3348 semi-colon in comments in .q file does not work
(Nick Collins via namit)


Added:
    hive/trunk/ql/src/test/queries/clientpositive/semicolon.q
    hive/trunk/ql/src/test/results/clientpositive/semicolon.q.out
Modified:
    hive/trunk/ql/src/test/org/apache/hadoop/hive/ql/QTestUtil.java

Modified: hive/trunk/ql/src/test/org/apache/hadoop/hive/ql/QTestUtil.java
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/test/org/apache/hadoop/hive/ql/QTestUtil.java?rev=1460990&r1=1460989&r2=1460990&view=diff
==============================================================================
--- hive/trunk/ql/src/test/org/apache/hadoop/hive/ql/QTestUtil.java (original)
+++ hive/trunk/ql/src/test/org/apache/hadoop/hive/ql/QTestUtil.java Tue Mar 26 06:53:16 2013
@@ -776,7 +776,18 @@ public class QTestUtil {
   }
 
   public int executeClient(String tname) {
-    return cliDriver.processLine(qMap.get(tname));
+    String commands = qMap.get(tname);
+    StringBuilder newCommands = new StringBuilder(commands.length());
+    int lastMatchEnd = 0;
+    Matcher commentMatcher = Pattern.compile("^--.*$", Pattern.MULTILINE).matcher(commands);
+    while (commentMatcher.find()) {
+      newCommands.append(commands.substring(lastMatchEnd, commentMatcher.start()));
+      newCommands.append(commentMatcher.group().replaceAll("(?<!\\\\);", "\\\\;"));
+      lastMatchEnd = commentMatcher.end();
+    }
+    newCommands.append(commands.substring(lastMatchEnd, commands.length()));
+    commands = newCommands.toString();
+    return cliDriver.processLine(commands);
   }
 
   public boolean shouldBeSkipped(String tname) {

Added: hive/trunk/ql/src/test/queries/clientpositive/semicolon.q
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/test/queries/clientpositive/semicolon.q?rev=1460990&view=auto
==============================================================================
--- hive/trunk/ql/src/test/queries/clientpositive/semicolon.q (added)
+++ hive/trunk/ql/src/test/queries/clientpositive/semicolon.q Tue Mar 26 06:53:16 2013
@@ -0,0 +1,4 @@
+-- comment
+-- comment;
+-- comment
+SELECT COUNT(1) FROM src;

Added: hive/trunk/ql/src/test/results/clientpositive/semicolon.q.out
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/test/results/clientpositive/semicolon.q.out?rev=1460990&view=auto
==============================================================================
--- hive/trunk/ql/src/test/results/clientpositive/semicolon.q.out (added)
+++ hive/trunk/ql/src/test/results/clientpositive/semicolon.q.out Tue Mar 26 06:53:16 2013
@@ -0,0 +1,15 @@
+PREHOOK: query: -- comment
+-- comment;
+-- comment
+SELECT COUNT(1) FROM src
+PREHOOK: type: QUERY
+PREHOOK: Input: default@src
+#### A masked pattern was here ####
+POSTHOOK: query: -- comment
+-- comment;
+-- comment
+SELECT COUNT(1) FROM src
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@src
+#### A masked pattern was here ####
+500



Mime
View raw message