You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@impala.apache.org by ph...@apache.org on 2018/02/02 18:51:31 UTC
[07/19] impala git commit: IMPALA-6447: remove Python 2.7 dictionary
comprehensions
IMPALA-6447: remove Python 2.7 dictionary comprehensions
In the fix for IMPALA-6441, we began importing from the stress test
(concurrent_select.py). The import fails on some downstream environments
that use Python 2.6. The failure is due to the fact that
concurrent_select.py uses a few dictionary comprehensions, a language
feature introduced in Python 2.7.
This problem wasn't caught upstream, because upstream is using
Python2.7.
The fix is to remove the dictionary comprehensions and create the
dictionaries in a more backward-compatible way. The problematic import
succeeds on Python 2.6.
Change-Id: I3174e1bd1b6ac007b345d42474401af50d006a52
Reviewed-on: http://gerrit.cloudera.org:8080/9150
Reviewed-by: Dimitris Tsirogiannis <dt...@cloudera.com>
Reviewed-by: David Knupp <dk...@cloudera.com>
Tested-by: Impala Public Jenkins
Project: http://git-wip-us.apache.org/repos/asf/impala/repo
Commit: http://git-wip-us.apache.org/repos/asf/impala/commit/44ba20a2
Tree: http://git-wip-us.apache.org/repos/asf/impala/tree/44ba20a2
Diff: http://git-wip-us.apache.org/repos/asf/impala/diff/44ba20a2
Branch: refs/heads/2.x
Commit: 44ba20a2cb954084aa40f62bf53b4ab9a0e46179
Parents: e0b3a48
Author: Michael Brown <mi...@cloudera.com>
Authored: Mon Jan 29 11:37:51 2018 -0800
Committer: Impala Public Jenkins <im...@gerrit.cloudera.org>
Committed: Fri Feb 2 01:10:15 2018 +0000
----------------------------------------------------------------------
tests/comparison/query_profile.py | 3 ++-
tests/stress/concurrent_select.py | 4 ++--
2 files changed, 4 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/impala/blob/44ba20a2/tests/comparison/query_profile.py
----------------------------------------------------------------------
diff --git a/tests/comparison/query_profile.py b/tests/comparison/query_profile.py
index 81a98a1..5530104 100644
--- a/tests/comparison/query_profile.py
+++ b/tests/comparison/query_profile.py
@@ -514,7 +514,8 @@ class DefaultProfile(object):
func_weights = _func_weights
if func_weights:
distinct_funcs_in_signatures = set([s.func for s in signatures])
- pruned_func_weights = {f: func_weights[f] for f in distinct_funcs_in_signatures}
+ pruned_func_weights = dict(
+ (f, func_weights[f]) for f in distinct_funcs_in_signatures)
func_weights = pruned_func_weights
else:
# First a function will be chosen then a signature. This is done so that the number
http://git-wip-us.apache.org/repos/asf/impala/blob/44ba20a2/tests/stress/concurrent_select.py
----------------------------------------------------------------------
diff --git a/tests/stress/concurrent_select.py b/tests/stress/concurrent_select.py
index 69a4434..86e8978 100755
--- a/tests/stress/concurrent_select.py
+++ b/tests/stress/concurrent_select.py
@@ -1641,7 +1641,7 @@ def prepare_database(cursor):
Note: At this time we only support Kudu tables with a simple hash partitioning based on
the primary key. (SHOW CREATE TABLE would not work otherwise.)
"""
- tables = {t: cursor.describe_table(t) for t in cursor.list_table_names()}
+ tables = dict((t, cursor.describe_table(t)) for t in cursor.list_table_names())
for table_name in tables:
if not table_name.endswith("_original") and table_name + "_original" not in tables:
LOG.debug("Creating original table: {0}".format(table_name))
@@ -1665,7 +1665,7 @@ def reset_databases(cursor):
the primary key. (SHOW CREATE TABLE would not work otherwise.)
"""
LOG.info("Resetting {0} database".format(cursor.db_name))
- tables = {t: cursor.describe_table(t) for t in cursor.list_table_names()}
+ tables = dict((t, cursor.describe_table(t)) for t in cursor.list_table_names())
for table_name in tables:
if not table_name.endswith("_original"):
if table_name + "_original" in tables: