You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@impala.apache.org by ta...@apache.org on 2017/10/26 01:50:31 UTC

[4/4] incubator-impala git commit: IMPALA-6106: handle comments before set in test parser

IMPALA-6106: handle comments before set in test parser

The tpcds-q22a.test test file has a comment before a "set" command.
The regex used to match "set" commands does not handle preceding
comments, which are part of the query statement.

Testing:
Ran the test with the below command and confirmed that DECIMAL_V2 was
automatically set back to 0.

  impala-py.test tests/query_test/test_tpcds_queries.py -k 22a \
      --capture=no

Change-Id: Id549dd3369dd163f3b3c8fe5685a52e0e6b2d134
Reviewed-on: http://gerrit.cloudera.org:8080/8384
Reviewed-by: Michael Brown <mi...@cloudera.com>
Tested-by: Impala Public Jenkins


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

Branch: refs/heads/master
Commit: 839c45777b32b50b6d44e60593a39266338754d3
Parents: 1a74b24
Author: Tim Armstrong <ta...@cloudera.com>
Authored: Wed Oct 25 13:51:44 2017 -0700
Committer: Impala Public Jenkins <im...@gerrit.cloudera.org>
Committed: Thu Oct 26 00:35:39 2017 +0000

----------------------------------------------------------------------
 tests/common/impala_test_suite.py | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/839c4577/tests/common/impala_test_suite.py
----------------------------------------------------------------------
diff --git a/tests/common/impala_test_suite.py b/tests/common/impala_test_suite.py
index 6c23aa8..1581e9b 100644
--- a/tests/common/impala_test_suite.py
+++ b/tests/common/impala_test_suite.py
@@ -100,7 +100,11 @@ IMPALA_HOME = os.getenv("IMPALA_HOME")
 EE_TEST_LOGS_DIR = os.getenv("IMPALA_EE_TEST_LOGS_DIR")
 # Match any SET statement. Assume that query options' names
 # only contain alphabets, underscores and digits after position 1.
-SET_PATTERN = re.compile(r'\s*set\s*([a-zA-Z_][a-zA-Z0-9_]*)\s*=*', re.I)
+# The statement may include SQL line comments starting with --, which we need to
+# strip out. The test file parser already strips out comments starting with #.
+COMMENT_LINES_REGEX = r'(?:\s*--.*\n)*'
+SET_PATTERN = re.compile(
+    COMMENT_LINES_REGEX + r'\s*set\s*([a-zA-Z_][a-zA-Z0-9_]*)\s*=*', re.I)
 
 # Base class for Impala tests. All impala test cases should inherit from this class
 class ImpalaTestSuite(BaseTestSuite):