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 2018/04/03 17:21:07 UTC

impala git commit: IMPALA-6780: Fix always-true asserts in test_recover_partitions.py

Repository: impala
Updated Branches:
  refs/heads/master 89b29d3a8 -> d478c492b


IMPALA-6780: Fix always-true asserts in test_recover_partitions.py

Fixes the following syntax issue leading to an always-true assert:
assert (cond, msg) <-- always true

Instead, this should be used:
assert cond, msg <-- cond and msg can optionally have parenthesis

Testing:
- Locally ran test_recover_partitions.py
- Searched for other tests with similar mistakes (none identified)

Change-Id: If38efa62c2496b69ae891bf916482d697bfc719f
Reviewed-on: http://gerrit.cloudera.org:8080/9886
Tested-by: Impala Public Jenkins
Reviewed-by: Alex Behm <al...@cloudera.com>


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

Branch: refs/heads/master
Commit: d478c492bd4e1bac4ab84d63eafb788940e49d53
Parents: 89b29d3
Author: Alex Behm <al...@cloudera.com>
Authored: Mon Apr 2 10:56:00 2018 -0700
Committer: Alex Behm <al...@cloudera.com>
Committed: Tue Apr 3 08:05:22 2018 +0000

----------------------------------------------------------------------
 tests/metadata/test_recover_partitions.py | 46 +++++++++++++-------------
 1 file changed, 23 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/impala/blob/d478c492/tests/metadata/test_recover_partitions.py
----------------------------------------------------------------------
diff --git a/tests/metadata/test_recover_partitions.py b/tests/metadata/test_recover_partitions.py
index 0f87a9f..2d17d3d 100644
--- a/tests/metadata/test_recover_partitions.py
+++ b/tests/metadata/test_recover_partitions.py
@@ -88,13 +88,13 @@ class TestRecoverPartitions(ImpalaTestSuite):
         "ALTER TABLE %s RECOVER PARTITIONS" % FQ_TBL_NAME)
     result = self.execute_query_expect_success(self.client,
         "SHOW PARTITIONS %s" % FQ_TBL_NAME)
-    assert (self.has_value(PART_NAME, result.data),
-        "ALTER TABLE %s RECOVER PARTITIONS failed." % FQ_TBL_NAME)
+    assert self.has_value(PART_NAME, result.data),\
+        "ALTER TABLE %s RECOVER PARTITIONS failed." % FQ_TBL_NAME
     result = self.execute_query_expect_success(self.client,
         "select c from %s" % FQ_TBL_NAME)
-    assert (self.has_value(INSERTED_VALUE, result.data),
-        "Failed to load tables after ALTER TABLE %s RECOVER PARTITIONS."
-        % FQ_TBL_NAME)
+    assert self.has_value(INSERTED_VALUE, result.data),\
+        "Failed to load tables after ALTER TABLE %s RECOVER PARTITIONS."\
+        % FQ_TBL_NAME
 
     # Test that invalid partition values are ignored during partition recovery.
     result = self.execute_query_expect_success(self.client,
@@ -105,9 +105,9 @@ class TestRecoverPartitions(ImpalaTestSuite):
         "ALTER TABLE %s RECOVER PARTITIONS" % FQ_TBL_NAME)
     result = self.execute_query_expect_success(self.client,
         "SHOW PARTITIONS %s" % FQ_TBL_NAME)
-    assert (len(result.data) == old_length,
-        "ALTER TABLE %s RECOVER PARTITIONS failed to handle invalid partition values."
-        % FQ_TBL_NAME)
+    assert len(result.data) == old_length,\
+        "ALTER TABLE %s RECOVER PARTITIONS failed to handle invalid partition values."\
+        % FQ_TBL_NAME
 
     # Create a directory whose subdirectory names contain __HIVE_DEFAULT_PARTITION__
     # and check that is recovered as a NULL partition.
@@ -121,9 +121,9 @@ class TestRecoverPartitions(ImpalaTestSuite):
         "ALTER TABLE %s RECOVER PARTITIONS" % FQ_TBL_NAME)
     result = self.execute_query_expect_success(self.client,
         "SHOW PARTITIONS %s" % FQ_TBL_NAME)
-    assert (self.has_value("NULL", result.data),
-        "ALTER TABLE %s RECOVER PARTITIONS failed to handle null partition values."
-        % FQ_TBL_NAME)
+    assert self.has_value("NULL", result.data),\
+        "ALTER TABLE %s RECOVER PARTITIONS failed to handle null partition values."\
+        % FQ_TBL_NAME
     result = self.execute_query_expect_success(self.client,
         "select c from %s" % FQ_TBL_NAME)
     assert self.has_value(NULL_INSERTED_VALUE, result.data)
@@ -252,9 +252,9 @@ class TestRecoverPartitions(ImpalaTestSuite):
         "ALTER TABLE %s RECOVER PARTITIONS" % FQ_TBL_NAME)
     result = self.execute_query_expect_success(self.client,
         "SHOW PARTITIONS %s" % FQ_TBL_NAME)
-    assert ((old_length + 1) == len(result.data),
-        "ALTER TABLE %s RECOVER PARTITIONS failed to handle duplicate partition key values."
-        % FQ_TBL_NAME)
+    assert old_length + 1 == len(result.data),\
+        "ALTER TABLE %s RECOVER PARTITIONS failed to handle "\
+        "duplicate partition key values." % FQ_TBL_NAME
 
   @SkipIfLocal.hdfs_client
   def test_post_invalidate(self, vector, unique_database):
@@ -285,9 +285,9 @@ class TestRecoverPartitions(ImpalaTestSuite):
     self.client.execute("INVALIDATE METADATA %s" % FQ_TBL_NAME)
     result = self.execute_query_expect_success(self.client,
         "select c from %s" % FQ_TBL_NAME)
-    assert (self.has_value(INSERTED_VALUE, result.data),
-        "INVALIDATE can't work on partitions recovered by ALTER TABLE %s RECOVER PARTITIONS."
-        % FQ_TBL_NAME)
+    assert self.has_value(INSERTED_VALUE, result.data),\
+        "INVALIDATE can't work on partitions recovered by "\
+        "ALTER TABLE %s RECOVER PARTITIONS." % FQ_TBL_NAME
     self.execute_query_expect_success(self.client,
         "INSERT INTO TABLE %s PARTITION(i=002, p='p2') VALUES(4)" % FQ_TBL_NAME)
     result = self.execute_query_expect_success(self.client,
@@ -329,9 +329,9 @@ class TestRecoverPartitions(ImpalaTestSuite):
         "ALTER TABLE %s RECOVER PARTITIONS" % FQ_TBL_NAME)
     result = self.execute_query_expect_success(self.client,
         "SHOW PARTITIONS %s" % FQ_TBL_NAME)
-    assert (len(result.data) == (old_length + 1),
-        "ALTER TABLE %s RECOVER PARTITIONS failed to handle some data types."
-        % FQ_TBL_NAME)
+    assert len(result.data) == (old_length + 1),\
+        "ALTER TABLE %s RECOVER PARTITIONS failed to handle some data types."\
+        % FQ_TBL_NAME
 
     # Test malformed partition values.
     self.check_invalid_partition_values(FQ_TBL_NAME, TBL_LOCATION,
@@ -386,9 +386,9 @@ class TestRecoverPartitions(ImpalaTestSuite):
           "ALTER TABLE %s RECOVER PARTITIONS" % fq_tbl_name)
       result = self.execute_query_expect_success(self.client,
           "SHOW PARTITIONS %s" % fq_tbl_name)
-      assert (len(result.data) == old_length,
-        "ALTER TABLE %s RECOVER PARTITIONS failed to handle invalid partition key values."
-        % fq_tbl_name)
+      assert len(result.data) == old_length,\
+        "ALTER TABLE %s RECOVER PARTITIONS failed to handle "\
+        "invalid partition key values." % fq_tbl_name
 
   def has_value(self, value, lines):
     """Check if lines contain value."""