Skip to content

Commit

Permalink
IMPALA-12485: Remove Python 2 has_key
Browse files Browse the repository at this point in the history
Switch calls to dict#has_key (Python 2-only) for 'key in dict' syntax.

Change-Id: I08e9f6667011d70ceddbf919a61d1be7d6e07ee4
Reviewed-on: http://gerrit.cloudera.org:8080/20541
Reviewed-by: Impala Public Jenkins <impala-public-jenkins@cloudera.com>
Tested-by: Impala Public Jenkins <impala-public-jenkins@cloudera.com>
  • Loading branch information
MikaelSmith authored and Impala Public Jenkins committed Oct 10, 2023
1 parent fd0d88d commit 8b2598c
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion common/thrift/generate_metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ def generate_mdl():
mdl['version'] = options.output_mdl_version
for role in mdl['roles']:
role_metrics = []
if metrics_by_role.has_key(role['name']):
if role['name'] in metrics_by_role:
role_metrics = metrics_by_role[role['name']]
role['metricDefinitions'] = role_metrics

Expand Down
2 changes: 1 addition & 1 deletion tests/common/test_vector.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ def clear_dimension(self, dimension_name):
del self.dimensions[dimension_name]

def has_dimension(self, dimension_name):
return self.dimensions.has_key(dimension_name)
return dimension_name in self.dimensions

def generate_test_vectors(self, exploration_strategy):
if not self.dimensions:
Expand Down
2 changes: 1 addition & 1 deletion tests/query_test/test_cancellation.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ def execute_cancel_test(self, vector):
self.cleanup_test_table(vector.get_value('table_format'))
file_format = vector.get_value('table_format').file_format
if file_format == 'kudu':
assert QUERIES.has_key(query) and QUERIES[query] is not None,\
assert query in QUERIES and QUERIES[query] is not None,\
"PRIMARY KEY for query %s not specified" % query
query = "create table ctas_cancel primary key (%s) "\
"partition by hash partitions 3 stored as kudu as %s" %\
Expand Down

0 comments on commit 8b2598c

Please sign in to comment.