Quanlong Huang has posted comments on this change. ( http://gerrit.cloudera.org:8080/20367 )
Change subject: IMPALA-10976: Sync db/table to latest HMS event for all DDL/DMLs ...................................................................... Patch Set 25: (1 comment) http://gerrit.cloudera.org:8080/#/c/20367/25/tests/custom_cluster/test_sync_to_latest_hms_events.py File tests/custom_cluster/test_sync_to_latest_hms_events.py: http://gerrit.cloudera.org:8080/#/c/20367/25/tests/custom_cluster/test_sync_to_latest_hms_events.py@84 PS25, Line 84: class_instance It's weird to use a class instance. I think we can use the class name directly. I tried removing this and it works. Could you try the same for other places? diff --git a/tests/custom_cluster/test_sync_to_latest_hms_events.py b/tests/custom_cluster/test_sync_to_latest_hms_events.py index 5c4570b91..bc7e85ca3 100644 --- a/tests/custom_cluster/test_sync_to_latest_hms_events.py +++ b/tests/custom_cluster/test_sync_to_latest_hms_events.py @@ -80,9 +80,8 @@ class TestSyncToLatestHmsEvents(CustomClusterTestSuite): @CustomClusterTestSuite.with_args( impalad_args="--use_local_catalog=true", catalogd_args=CATALOGD_ARGS_ENABLE_SYNC_EVENTS) - def test_alter_table_set_owner(self, vector, unique_database): - TestDdlStatements._test_alter_table_set_owner_impl(self.client, class_instance, - vector, unique_database) + def test_alter_table_set_owner(self, unique_database): + TestDdlStatements._test_alter_table_set_owner_impl(self.client, unique_database) @CustomClusterTestSuite.with_args( impalad_args="--use_local_catalog=true", diff --git a/tests/metadata/test_ddl.py b/tests/metadata/test_ddl.py index 054d40ac1..a93522cd0 100644 --- a/tests/metadata/test_ddl.py +++ b/tests/metadata/test_ddl.py @@ -265,20 +265,19 @@ class TestDdlStatements(TestDdlBase): unique_database)).get_data() assert "INT\tf()\tNATIVE\ttrue" == func_names - def test_alter_table_set_owner(self, vector, unique_database): - self._test_alter_table_set_owner_impl(self.client, self, vector, unique_database) + def test_alter_table_set_owner(self, unique_database): + self._test_alter_table_set_owner_impl(self.client, unique_database) @classmethod - def _test_alter_table_set_owner_impl(self, client, class_instance, vector, - unique_database): + def _test_alter_table_set_owner_impl(self, client, unique_database): table_name = "{0}.test_owner_tbl".format(unique_database) client.execute("create table {0}(i int)".format(table_name)) client.execute("alter table {0} set owner user foo_user".format(table_name)) - owner = class_instance._get_table_or_view_owner(client, table_name) + owner = TestDdlBase._get_table_or_view_owner(client, table_name) assert ('foo_user', 'USER') == owner client.execute("alter table {0} set owner role foo_role".format(table_name)) - owner = class_instance._get_table_or_view_owner(client, table_name) + owner = TestDdlBase._get_table_or_view_owner(client, table_name) assert ('foo_role', 'ROLE') == owner diff --git a/tests/metadata/test_ddl_base.py b/tests/metadata/test_ddl_base.py index ff5bf657c..fa3d9b3e3 100644 --- a/tests/metadata/test_ddl_base.py +++ b/tests/metadata/test_ddl_base.py @@ -98,7 +98,8 @@ class TestDdlBase(ImpalaTestSuite): properties[fields[1].rstrip()] = fields[2].rstrip() return properties - def _get_property(self, property_name, client, name, is_db=False): + @classmethod + def _get_property(cls, property_name, client, name, is_db=False): """Extracts a db/table property value from the output of DESCRIBE FORMATTED.""" result = client.execute("describe {0} formatted {1}".format( "database" if is_db else "", name)) @@ -128,8 +129,9 @@ class TestDdlBase(ImpalaTestSuite): comments[cols[0].rstrip()] = cols[2].rstrip() return comments.get(col_name) - def _get_table_or_view_owner(self, client, table_name): + @classmethod + def _get_table_or_view_owner(cls, client, table_name): """Returns a tuple(owner, owner_type) for a given table name""" - owner_name = self._get_property("Owner:", client, table_name) - owner_type = self._get_property("OwnerType:", client, table_name) + owner_name = cls._get_property("Owner:", client, table_name) + owner_type = cls._get_property("OwnerType:", client, table_name) return (owner_name, owner_type) -- To view, visit http://gerrit.cloudera.org:8080/20367 To unsubscribe, visit http://gerrit.cloudera.org:8080/settings Gerrit-Project: Impala-ASF Gerrit-Branch: master Gerrit-MessageType: comment Gerrit-Change-Id: Ia250d0a943838086c187e5cb7c60035e5a564bbf Gerrit-Change-Number: 20367 Gerrit-PatchSet: 25 Gerrit-Owner: Sai Hemanth Gantasala <saihema...@cloudera.com> Gerrit-Reviewer: Anonymous Coward <k.venureddy2...@gmail.com> Gerrit-Reviewer: Csaba Ringhofer <csringho...@cloudera.com> Gerrit-Reviewer: Impala Public Jenkins <impala-public-jenk...@cloudera.com> Gerrit-Reviewer: Quanlong Huang <huangquanl...@gmail.com> Gerrit-Reviewer: Sai Hemanth Gantasala <saihema...@cloudera.com> Gerrit-Comment-Date: Mon, 08 Jan 2024 08:21:31 +0000 Gerrit-HasComments: Yes