You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by xu...@apache.org on 2014/05/23 00:13:23 UTC
svn commit: r1596976 - in /hive/trunk:
beeline/src/java/org/apache/hive/beeline/BeeLine.java
itests/hive-unit/src/test/java/org/apache/hive/beeline/TestBeeLineWithArgs.java
Author: xuefu
Date: Thu May 22 22:13:23 2014
New Revision: 1596976
URL: http://svn.apache.org/r1596976
Log:
HIVE-6684: Beeline does not accept comments that are preceded by spaces (Jeremy Beard via Xuefu)
Modified:
hive/trunk/beeline/src/java/org/apache/hive/beeline/BeeLine.java
hive/trunk/itests/hive-unit/src/test/java/org/apache/hive/beeline/TestBeeLineWithArgs.java
Modified: hive/trunk/beeline/src/java/org/apache/hive/beeline/BeeLine.java
URL: http://svn.apache.org/viewvc/hive/trunk/beeline/src/java/org/apache/hive/beeline/BeeLine.java?rev=1596976&r1=1596975&r2=1596976&view=diff
==============================================================================
--- hive/trunk/beeline/src/java/org/apache/hive/beeline/BeeLine.java (original)
+++ hive/trunk/beeline/src/java/org/apache/hive/beeline/BeeLine.java Thu May 22 22:13:23 2014
@@ -940,7 +940,8 @@ public class BeeLine {
boolean isComment(String line) {
// SQL92 comment prefix is "--"
// beeline also supports shell-style "#" prefix
- return line.startsWith("#") || line.startsWith("--");
+ String lineTrimmed = line.trim();
+ return lineTrimmed.startsWith("#") || lineTrimmed.startsWith("--");
}
/**
Modified: hive/trunk/itests/hive-unit/src/test/java/org/apache/hive/beeline/TestBeeLineWithArgs.java
URL: http://svn.apache.org/viewvc/hive/trunk/itests/hive-unit/src/test/java/org/apache/hive/beeline/TestBeeLineWithArgs.java?rev=1596976&r1=1596975&r2=1596976&view=diff
==============================================================================
--- hive/trunk/itests/hive-unit/src/test/java/org/apache/hive/beeline/TestBeeLineWithArgs.java (original)
+++ hive/trunk/itests/hive-unit/src/test/java/org/apache/hive/beeline/TestBeeLineWithArgs.java Thu May 22 22:13:23 2014
@@ -191,6 +191,19 @@ public class TestBeeLineWithArgs {
}
scriptFile.delete();
}
+
+ /**
+ * Test that BeeLine will read comment lines that start with whitespace
+ * @throws Throwable
+ */
+ @Test
+ public void testWhitespaceBeforeCommentScriptFile() throws Throwable {
+ final String TEST_NAME = "testWhitespaceBeforeCommentScriptFile";
+ final String SCRIPT_TEXT = " -- comment has spaces and tabs before it\n # comment has spaces and tabs before it\n";
+ final String EXPECTED_PATTERN = "cannot recognize input near '<EOF>'";
+ List<String> argList = getBaseArgs(JDBC_URL);
+ testScriptFile(TEST_NAME, SCRIPT_TEXT, EXPECTED_PATTERN, false, argList);
+ }
/**
* Attempt to execute a simple script file with the -f option to BeeLine