You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@impala.apache.org by tm...@apache.org on 2018/05/30 18:09:37 UTC

[2/5] impala git commit: Revert IMPALA-2751: Matching quotes are not requirerd in comments

Revert IMPALA-2751: Matching quotes are not requirerd in comments

This patch is causing a large number of builds to fail, see
IMPALA-7089.

Change-Id: Id9995a91408d86a5ae1ecd70d07b02622ae26b43
Reviewed-on: http://gerrit.cloudera.org:8080/10537
Reviewed-by: Philip Zeyliger <ph...@cloudera.com>
Tested-by: Impala Public Jenkins <im...@cloudera.com>


Project: http://git-wip-us.apache.org/repos/asf/impala/repo
Commit: http://git-wip-us.apache.org/repos/asf/impala/commit/84b55c61
Tree: http://git-wip-us.apache.org/repos/asf/impala/tree/84b55c61
Diff: http://git-wip-us.apache.org/repos/asf/impala/diff/84b55c61

Branch: refs/heads/master
Commit: 84b55c6148dd4e756359717cca30a8eea71cb62a
Parents: ba7893c
Author: Thomas Tauber-Marshall <tm...@cloudera.com>
Authored: Tue May 29 17:30:23 2018 -0700
Committer: Impala Public Jenkins <im...@cloudera.com>
Committed: Wed May 30 08:12:58 2018 +0000

----------------------------------------------------------------------
 shell/impala_shell.py                 | 12 +++++-------
 tests/shell/test_shell_interactive.py | 18 ------------------
 2 files changed, 5 insertions(+), 25 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/impala/blob/84b55c61/shell/impala_shell.py
----------------------------------------------------------------------
diff --git a/shell/impala_shell.py b/shell/impala_shell.py
index 0f14d97..55ea692 100755
--- a/shell/impala_shell.py
+++ b/shell/impala_shell.py
@@ -401,8 +401,7 @@ class ImpalaShell(object, cmd.Cmd):
       try:
         # Look for an open quotation in the entire command, and not just the
         # current line.
-        if self.partial_cmd:
-          line = sqlparse.format('%s %s' % (self.partial_cmd, line), strip_comments=True)
+        if self.partial_cmd: line = '%s %s' % (self.partial_cmd, line)
         self._shlex_split(line)
         return True
       # If the command ends with a delimiter, check if it has an open quotation.
@@ -420,8 +419,8 @@ class ImpalaShell(object, cmd.Cmd):
     # Iterate through the line and switch the state if a single or double quote is found
     # and ignore escaped single and double quotes if the line is considered open (meaning
     # a previous single or double quote has not been closed yet)
-      state_closed = True
-      opener = None
+      state_closed = True;
+      opener = None;
       for i, char in enumerate(line):
         if state_closed and (char in ['\'', '\"']):
           state_closed = False
@@ -429,7 +428,7 @@ class ImpalaShell(object, cmd.Cmd):
         elif not state_closed and opener == char:
           if line[i - 1] != '\\':
             state_closed = True
-            opener = None
+            opener = None;
 
       return state_closed
 
@@ -1133,8 +1132,7 @@ class ImpalaShell(object, cmd.Cmd):
     query = self._create_beeswax_query(args)
     # Set posix=True and add "'" to escaped quotes
     # to deal with escaped quotes in string literals
-    lexer = shlex.shlex(sqlparse.format(query.query.lstrip(), strip_comments=True),
-                        posix=True)
+    lexer = shlex.shlex(query.query.lstrip(), posix=True)
     lexer.escapedquotes += "'"
     # Because the WITH clause may precede DML or SELECT queries,
     # just checking the first token is insufficient.

http://git-wip-us.apache.org/repos/asf/impala/blob/84b55c61/tests/shell/test_shell_interactive.py
----------------------------------------------------------------------
diff --git a/tests/shell/test_shell_interactive.py b/tests/shell/test_shell_interactive.py
index 2f5278f..f53ee5a 100755
--- a/tests/shell/test_shell_interactive.py
+++ b/tests/shell/test_shell_interactive.py
@@ -516,24 +516,6 @@ class TestImpalaShellInteractive(object):
     assert '| 1"23"4 |' in result.stdout
 
   @pytest.mark.execute_serially
-  def test_comment_with_quotes(self):
-    # IMPALA-2751: Comment does not need to have matching quotes
-    queries = [
-      "select -- '\n1;",
-      'select -- "\n1;',
-      "select -- \"'\n 1;",
-      "select /*'\n*/ 1;",
-      'select /*"\n*/ 1;',
-      "select /*\"'\n*/ 1;",
-      "with a as (\nselect 1\n-- '\n) select * from a",
-      'with a as (\nselect 1\n-- "\n) select * from a',
-      "with a as (\nselect 1\n-- '\"\n) select * from a",
-    ]
-    for query in queries:
-      result = run_impala_shell_interactive(query)
-      assert '| 1 |' in result.stdout
-
-  @pytest.mark.execute_serially
   def test_shell_prompt(self):
     proc = pexpect.spawn(SHELL_CMD)
     proc.expect(":21000] default>")