IMPALA-11389: Include Python 3 eggs in tarball

Build Python 3 eggs for the shell tarball so it works with both Python 2
and Python 3. The impala-shell script selects eggs based on the
available Python version.

Inlines thrift for impala-shell so we can easily build Python 2 and
Python 3 versions, consistent with other libraries. The impala-shell
version should always be at least as new as IMPALA_THRIFT_PY_VERSION.

Thrift 0.13.0+ wraps all exceptions during TSocket read/write operations
in TTransportException. Specifically socket.error that we got as raw
exceptions are now wrapped. Unwraps them before raising to preserve
prior behavior.

A specific Python version can be selected with IMPALA_PYTHON_EXECUTABLE;
otherwise it will use 'python', and if unavailable try 'python3'.

Adds tests for impala-shell tarball with Python 3.

Change-Id: I94f86de9e2a6303151c2f0e6454b5f629cbc9444
Reviewed-on: http://gerrit.cloudera.org:8080/18653
Reviewed-by: Wenzhe Zhou <wzhou@cloudera.com>
Reviewed-by: Joe McDonnell <joemcdonnell@cloudera.com>
Tested-by: Impala Public Jenkins <impala-public-jenkins@cloudera.com>
This commit is contained in:
Michael Smith
2022-06-22 11:25:35 -07:00
committed by Joe McDonnell
parent f24296aed5
commit 64b324ac40
71 changed files with 10658 additions and 42 deletions

View File

@@ -180,13 +180,13 @@ def get_shell_cmd(vector):
impala_shell_executable = get_impala_shell_executable(vector)
if vector.get_value_with_default("strict_hs2_protocol", False):
protocol = vector.get_value("protocol")
return [impala_shell_executable,
return impala_shell_executable + [
"--protocol={0}".format(protocol),
"--strict_hs2_protocol",
"--use_ldap_test_password",
"-i{0}".format(get_impalad_host_port(vector))]
else:
return [impala_shell_executable,
return impala_shell_executable + [
"--protocol={0}".format(vector.get_value("protocol")),
"-i{0}".format(get_impalad_host_port(vector))]
@@ -340,9 +340,12 @@ def create_impala_shell_executable_dimension():
if 'DISABLE_PYTHON3_TEST' in os.environ:
return ImpalaTestDimension('impala_shell', 'dev', 'python2')
else:
return ImpalaTestDimension('impala_shell', 'dev', 'python2', 'python3')
return ImpalaTestDimension('impala_shell', 'dev', 'dev3', 'python2', 'python3')
else:
return ImpalaTestDimension('impala_shell', 'dev')
if 'DISABLE_PYTHON3_TEST' in os.environ:
return ImpalaTestDimension('impala_shell', 'dev')
else:
return ImpalaTestDimension('impala_shell', 'dev', 'dev3')
def get_impala_shell_executable(vector):
@@ -350,7 +353,8 @@ def get_impala_shell_executable(vector):
# use 'dev' as the default.
impala_shell_executable, _ = get_dev_impala_shell_executable()
return {
'dev': impala_shell_executable,
'python2': os.path.join(IMPALA_HOME, 'shell/build/py2_venv/bin/impala-shell'),
'python3': os.path.join(IMPALA_HOME, 'shell/build/py3_venv/bin/impala-shell')
'dev': [impala_shell_executable],
'dev3': ['env', 'IMPALA_PYTHON_EXECUTABLE=python3', impala_shell_executable],
'python2': [os.path.join(IMPALA_HOME, 'shell/build/py2_venv/bin/impala-shell')],
'python3': [os.path.join(IMPALA_HOME, 'shell/build/py3_venv/bin/impala-shell')]
}[vector.get_value_with_default('impala_shell', 'dev')]