mirror of
https://github.com/apache/impala.git
synced 2025-12-19 09:58:28 -05:00
IMPALA-14501: Migrate most scripts from impala-python to impala-python3
To remove the dependency on Python 2, existing scripts need to use python3 rather than python. These commands find those locations (for impala-python and regular python): git grep impala-python | grep -v impala-python3 | grep -v impala-python-common | grep -v init-impala-python git grep bin/python | grep -v python3 This removes or switches most of these locations by various means: 1. If a python file has a #!/bin/env impala-python (or python) but doesn't have a main function, it removes the hash-bang and makes sure that the file is not executable. 2. Most scripts can simply switch from impala-python to impala-python3 (or python to python3) with minimal changes. 3. The cm-api pypi package (which doesn't support Python 3) has been replaced by the cm-client pypi package and interfaces have changed. Rather than migrating the code (which hasn't been used in years), this deletes the old code and stops installing cm-api into the virtualenv. The code can be restored and revamped if there is any interest in interacting with CM clusters. 4. This switches tests/comparison over to impala-python3, but this code has bit-rotted. Some pieces can be run manually, but it can't be fully verified with Python 3. It shouldn't hold back the migration on its own. 5. This also replaces locations of impala-python in comments / documentation / READMEs. 6. kazoo (used for interacting with HBase) needed to be upgraded to a version that supports Python 3. The newest version of kazoo requires upgrades of other component versions, so this uses kazoo 2.8.0 to avoid needing other upgrades. The two remaining uses of impala-python are: - bin/cmake_aux/create_virtualenv.sh - bin/impala-env-versioned-python These will be removed separately when we drop Python 2 support completely. In particular, these are useful for testing impala-shell with Python 2 until we stop supporting Python 2 for impala-shell. The docker-based tests still use /usr/bin/python, but this can be switched over independently (and doesn't impact impala-python) Testing: - Ran core job - Ran build + dataload on Centos 7, Redhat 8 - Manual testing of individual scripts (except some bitrotted areas like the random query generator) Change-Id: If209b761290bc7e7c716c312ea757da3e3bca6dc Reviewed-on: http://gerrit.cloudera.org:8080/23468 Reviewed-by: Michael Smith <michael.smith@cloudera.com> Tested-by: Michael Smith <michael.smith@cloudera.com>
This commit is contained in:
committed by
Michael Smith
parent
c67b19daf6
commit
1913ab46ed
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env python
|
||||
# This uses system python to avoid a dependency on impala-python,
|
||||
#!/usr/bin/env python3
|
||||
# This uses system python to avoid a dependency on impala-python3,
|
||||
# because this runs during the build.
|
||||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
|
||||
@@ -491,7 +491,7 @@ ssh localhost whoami
|
||||
# listening on localhost. See also HDFS-13797. To reproduce this, the following
|
||||
# snippet may be useful:
|
||||
#
|
||||
# $impala-python
|
||||
# $impala-python3
|
||||
# >>> import logging
|
||||
# >>> logging.basicConfig(level=logging.DEBUG)
|
||||
# >>> logging.getLogger("requests.packages.urllib3").setLevel(logging.DEBUG)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env python
|
||||
#!/usr/bin/env python3
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
# distributed with this work for additional information
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#!/usr/bin/python
|
||||
#!/usr/bin/env python3
|
||||
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env python
|
||||
#!/usr/bin/env python3
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
# distributed with this work for additional information
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env python
|
||||
#!/usr/bin/env python3
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#!/usr/bin/python
|
||||
#!/usr/bin/env python3
|
||||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env impala-python
|
||||
#!/usr/bin/env impala-python3
|
||||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env python
|
||||
#!/usr/bin/env python3
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
# distributed with this work for additional information
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env python
|
||||
# This uses system python to avoid a dependency on impala-python,
|
||||
#!/usr/bin/env python3
|
||||
# This uses system python to avoid a dependency on impala-python3,
|
||||
# because this runs during the build.
|
||||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env impala-python
|
||||
#!/usr/bin/env impala-python3
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
# distributed with this work for additional information
|
||||
@@ -95,7 +95,7 @@ def generate_conf_files():
|
||||
f.write(CONFIG_FILE.format(options.log_dir, options.minidump_dir))
|
||||
|
||||
def random_bytes(num):
|
||||
return ''.join(chr(random.randint(0, 255)) for _ in range(num))
|
||||
return bytearray(random.getrandbits(8) for _ in range(num))
|
||||
|
||||
def write_minidump(common_data, timestamp, target_dir):
|
||||
'''Generate and write the minidump into the target_dir. atime and mtime of the minidump
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env python
|
||||
#!/usr/bin/env python3
|
||||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env impala-python
|
||||
#!/usr/bin/env impala-python3
|
||||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env impala-python
|
||||
#!/usr/bin/env impala-python3
|
||||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#!/usr/bin/python3
|
||||
#!/usr/bin/env python3
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
# distributed with this work for additional information
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env python
|
||||
#!/usr/bin/env python3
|
||||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#!/usr/bin/python
|
||||
#!/usr/bin/env python3
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
# distributed with this work for additional information
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#!/usr/bin/python3
|
||||
#!/usr/bin/env python3
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
# distributed with this work for additional information
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env impala-python
|
||||
#!/usr/bin/env impala-python3
|
||||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
@@ -220,7 +220,7 @@ def run_dataset_preload(dataset):
|
||||
dataset_preload_script = os.path.join(DATASET_DIR, dataset, "preload")
|
||||
if os.path.exists(dataset_preload_script):
|
||||
LOG.info("Running preload script for " + dataset)
|
||||
if options.scale_factor > 1:
|
||||
if options.scale_factor != "" and int(options.scale_factor) > 1:
|
||||
dataset_preload_script += " " + str(options.scale_factor)
|
||||
exec_cmd(dataset_preload_script, error_msg="Error executing preload script for " + dataset,
|
||||
exit_on_error=True)
|
||||
@@ -250,8 +250,8 @@ def get_dataset_for_workload(workload):
|
||||
if not os.path.isfile(dimension_file_name):
|
||||
LOG.error('Dimension file not found: ' + dimension_file_name)
|
||||
sys.exit(1)
|
||||
with open(dimension_file_name, 'rb') as input_file:
|
||||
match = re.search('dataset:\s*([\w\-\.]+)', input_file.read())
|
||||
with open(dimension_file_name, 'r') as input_file:
|
||||
match = re.search(r'dataset:\s*([\w\-\.]+)', input_file.read())
|
||||
if match:
|
||||
return match.group(1)
|
||||
else:
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env impala-python
|
||||
#!/usr/bin/env impala-python3
|
||||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env impala-python
|
||||
#!/usr/bin/env impala-python3
|
||||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
# Sets up the python path for impala-python. This is needed because tests and other
|
||||
# Sets up the python path for impala-python3. This is needed because tests and other
|
||||
# utility scripts depend on some modules external to infra/python/env-*.
|
||||
# TODO: we should try to reduce our reliance on PYTHONPATH if possible.
|
||||
#
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env impala-python
|
||||
#!/usr/bin/env impala-python3
|
||||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
@@ -210,7 +210,7 @@ def generate_profile_file(name, hash, base_dir):
|
||||
|
||||
Writes the runtime profiles back in a simple text file in the same directory.
|
||||
"""
|
||||
with open(name) as fid:
|
||||
with open(name, 'rb') as fid:
|
||||
data = json.loads(fid.read().decode("utf-8", "ignore"))
|
||||
with open(os.path.join(base_dir, hash + "_profile.txt"), "w+") as out:
|
||||
# For each query
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env python
|
||||
#!/usr/bin/env python3
|
||||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env python
|
||||
#!/usr/bin/env python3
|
||||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env python
|
||||
#!/usr/bin/env python3
|
||||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env python
|
||||
#!/usr/bin/env python3
|
||||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env python
|
||||
#!/usr/bin/env python3
|
||||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env impala-python
|
||||
#!/usr/bin/env impala-python3
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
# distributed with this work for additional information
|
||||
|
||||
@@ -147,7 +147,7 @@ public class LdapImpylaHttpTest {
|
||||
long failedBasicAuthBefore =
|
||||
(long) client_.getMetric("impala.thrift-server.hiveserver2-http-frontend."
|
||||
+ "total-basic-auth-failure");
|
||||
String[] noAuthCmd = {"impala-python", helper_, "--query", query_};
|
||||
String[] noAuthCmd = {"impala-python3", helper_, "--query", query_};
|
||||
RunShellCommand.Run(
|
||||
noAuthCmd, /*shouldSucceed*/ false, "", "HTTP code 401: Unauthorized");
|
||||
// Check that there is no authentication attempt.
|
||||
@@ -196,7 +196,7 @@ public class LdapImpylaHttpTest {
|
||||
|
||||
private String[] buildCommand(String user, String password, String httpPath,
|
||||
String cookieNames) {
|
||||
List<String> command = Lists.newArrayList(Arrays.asList("impala-python", helper_,
|
||||
List<String> command = Lists.newArrayList(Arrays.asList("impala-python3", helper_,
|
||||
"--user", user, "--password", password, "--query", query_));
|
||||
if (httpPath != null) command.addAll(Arrays.asList("--http_path", httpPath));
|
||||
if (cookieNames != null) {
|
||||
@@ -216,7 +216,7 @@ public class LdapImpylaHttpTest {
|
||||
String errTemplate = "User '%s' is not authorized to delegate to '%s'";
|
||||
|
||||
// Run with an invalid proxy user.
|
||||
//String[] command = {"impala-python", helper_, "--user", testUser2_, "--password",
|
||||
//String[] command = {"impala-python3", helper_, "--user", testUser2_, "--password",
|
||||
// testPassword2_, "--http_path=/?doAs=" + delegateUser_, "--query", query};
|
||||
String[] cmd =
|
||||
buildCommand(testUser2_, testPassword2_, "/?doAs=" + delegateUser_, null);
|
||||
@@ -230,7 +230,8 @@ public class LdapImpylaHttpTest {
|
||||
|
||||
// 'doAs' parameter that cannot be decoded.
|
||||
cmd = buildCommand(testUser_, testPassword_, "/?doAs=%", null);
|
||||
RunShellCommand.Run(cmd, /*shouldSucceed*/ false, "", "httplib.BadStatusLine");
|
||||
RunShellCommand.Run(cmd, /*shouldSucceed*/ false, "",
|
||||
"http.client.RemoteDisconnected");
|
||||
|
||||
// Successfully delegate.
|
||||
cmd = buildCommand(testUser_, testPassword_, "/?doAs=" + delegateUser_, null);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env python
|
||||
#!/usr/bin/env python3
|
||||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
|
||||
@@ -4,7 +4,7 @@ To install new packages:
|
||||
the package needs a C/C++ compiler to build . You should specify the version number
|
||||
using the "foo == x.y.z" notation so future upgrades can be done automatically.
|
||||
2) Run deps/download_requirements, it will download the package to the deps dir.
|
||||
3) Run the "impala-python" command, this should detect that requirements.txt changed and
|
||||
3) Run the "impala-python3" command, this should detect that requirements.txt changed and
|
||||
automatically rebuild the virtualenv.
|
||||
4) Now in the python prompt, you should be able to import the new module.
|
||||
|
||||
|
||||
@@ -17,9 +17,6 @@
|
||||
|
||||
# Python2-only requirements
|
||||
|
||||
cm-api == 10.0.0
|
||||
# Already available as part of python on Linux.
|
||||
readline == 6.2.4.1; sys_platform == 'darwin'
|
||||
flake8 == 3.9.2
|
||||
mccabe == 0.6.1
|
||||
pycodestyle == 2.7.0
|
||||
|
||||
@@ -31,6 +31,7 @@ pylint == 2.10.2
|
||||
platformdirs == 2.4.1
|
||||
typing-extensions == 3.10.0.2
|
||||
k5test==0.10.3
|
||||
kazoo==2.8.0
|
||||
|
||||
# Below are needed only for dev
|
||||
flake8==3.9.2
|
||||
|
||||
@@ -32,7 +32,6 @@ impyla == 0.21a3
|
||||
pure-sasl == 0.6.2
|
||||
# six == 1.14.0 (specified separately)
|
||||
thrift_sasl == 0.4.3
|
||||
kazoo == 2.2.1
|
||||
kerberos == 1.3.1
|
||||
pexpect == 3.3
|
||||
pg8000 == 1.10.2
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env python
|
||||
#!/usr/bin/env python3
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
# distributed with this work for additional information
|
||||
@@ -50,7 +50,7 @@ class JunitReport(object):
|
||||
Log files are timestamped, so they will not overwrite previous files containing
|
||||
output of the same step.
|
||||
|
||||
For use from within a python script (must be invoked with impala-python), an
|
||||
For use from within a python script (must be invoked with impala-python3), an
|
||||
example might look like:
|
||||
|
||||
>>> from impala_py_lib.jenkins.generate_junitxml import JunitReport
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env python
|
||||
#!/usr/bin/env python3
|
||||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
#!/usr/bin/env impala-python
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
# distributed with this work for additional information
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
|
||||
@@ -75,7 +75,8 @@ add_custom_target(shell_impala_build_version
|
||||
COMMAND "${CMAKE_SOURCE_DIR}/shell/gen_impala_build_version.sh"
|
||||
)
|
||||
|
||||
add_custom_target(shell_pypi_package DEPENDS gen-deps shell_impala_build_version impala_python
|
||||
add_custom_target(shell_pypi_package
|
||||
DEPENDS gen-deps shell_impala_build_version impala_python3
|
||||
COMMAND "${CMAKE_SOURCE_DIR}/shell/packaging/make_python_package.sh"
|
||||
)
|
||||
|
||||
@@ -88,7 +89,8 @@ set(SHELL_TEST_PKG
|
||||
"${CMAKE_SOURCE_DIR}/shell/build/dist/impala_shell-${PKG_VERSION}.tar.gz")
|
||||
get_filename_component(SHELL_TEST_PKG_DIR "${SHELL_TEST_PKG}" DIRECTORY)
|
||||
# Generates SHELL_TEST_PKG
|
||||
add_custom_target(shell_pypi_test_package DEPENDS gen-deps shell_impala_build_version impala_python
|
||||
add_custom_target(shell_pypi_test_package
|
||||
DEPENDS gen-deps shell_impala_build_version impala_python3
|
||||
COMMAND env BUILD_VERSION=${PKG_VERSION} OFFICIAL=true DIST_DIR="${SHELL_TEST_PKG_DIR}"
|
||||
"${CMAKE_SOURCE_DIR}/shell/packaging/make_python_package.sh"
|
||||
)
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
|
||||
1
shell/impala_shell/impala_client.py
Executable file → Normal file
1
shell/impala_shell/impala_client.py
Executable file → Normal file
@@ -1,4 +1,3 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
|
||||
1
shell/impala_shell/impala_shell.py
Executable file → Normal file
1
shell/impala_shell/impala_shell.py
Executable file → Normal file
@@ -1,4 +1,3 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
|
||||
@@ -65,7 +65,7 @@ create_distributable_python_package() {
|
||||
pushd "${PACKAGE_DIR}"
|
||||
echo "Building package..."
|
||||
PACKAGE_TYPE="${PACKAGE_TYPE:-}" OFFICIAL="${OFFICIAL:-}" \
|
||||
impala-python setup.py sdist --dist-dir "${DIST_DIR}"
|
||||
impala-python3 setup.py sdist --dist-dir "${DIST_DIR}"
|
||||
popd
|
||||
|
||||
if [[ "${NO_CLEAN_DIST}" != "true" ]]; then
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
@@ -94,7 +93,7 @@ def get_version():
|
||||
if os.getenv('BUILD_VERSION') is not None:
|
||||
package_version = os.getenv('BUILD_VERSION')
|
||||
else:
|
||||
version_match = re.search('\d+\.\d+\.\d+', impala_build_version.get_version())
|
||||
version_match = re.search(r'\d+\.\d+\.\d+', impala_build_version.get_version())
|
||||
if version_match is None:
|
||||
sys.exit('Unable to acquire Impala version.')
|
||||
package_version = version_match.group(0)
|
||||
@@ -102,7 +101,7 @@ def get_version():
|
||||
# packages can be marked as alpha, beta, or rc RELEASE_TYPE
|
||||
release_type = os.getenv('RELEASE_TYPE')
|
||||
if release_type:
|
||||
if not re.match('(a|b|rc)\d+?', release_type):
|
||||
if not re.match(r'(a|b|rc)\d+?', release_type):
|
||||
msg = """\
|
||||
RELEASE_TYPE \'{0}\' does not conform to any PEP-440 release format:
|
||||
|
||||
|
||||
2
testdata/bin/check-hbase-nodes.py
vendored
2
testdata/bin/check-hbase-nodes.py
vendored
@@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env impala-python
|
||||
#!/usr/bin/env impala-python3
|
||||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
|
||||
4
testdata/bin/create-load-data.sh
vendored
4
testdata/bin/create-load-data.sh
vendored
@@ -290,7 +290,7 @@ function load-data {
|
||||
LOG_FILE=${IMPALA_DATA_LOADING_LOGS_DIR}/${LOG_BASENAME}
|
||||
echo "$LOAD_MSG. Logging to ${LOG_FILE}"
|
||||
# Use unbuffered logging by executing with -u
|
||||
if ! impala-python -u ${IMPALA_HOME}/bin/load-data.py ${ARGS[@]} &> ${LOG_FILE}; then
|
||||
if ! impala-python3 -u ${IMPALA_HOME}/bin/load-data.py ${ARGS[@]} &> ${LOG_FILE}; then
|
||||
echo Error loading data. The end of the log file is:
|
||||
tail -n 50 $LOG_FILE
|
||||
return 1
|
||||
@@ -321,7 +321,7 @@ function load-aux-workloads {
|
||||
# Load all the auxiliary workloads (if any exist)
|
||||
if [ -d ${IMPALA_AUX_WORKLOAD_DIR} ] && [ -d ${IMPALA_AUX_DATASET_DIR} ]; then
|
||||
echo Loading auxiliary workloads. Logging to $LOG_FILE.
|
||||
if ! impala-python -u ${IMPALA_HOME}/bin/load-data.py --workloads all\
|
||||
if ! impala-python3 -u ${IMPALA_HOME}/bin/load-data.py --workloads all\
|
||||
--impalad=${IMPALAD}\
|
||||
--hive_hs2_hostport=${HS2_HOST_PORT}\
|
||||
--hdfs_namenode=${HDFS_NN}\
|
||||
|
||||
2
testdata/bin/create-tpc-jdbc-tables.py
vendored
2
testdata/bin/create-tpc-jdbc-tables.py
vendored
@@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env impala-python
|
||||
#!/usr/bin/env impala-python3
|
||||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
|
||||
2
testdata/bin/generate-schema-statements.py
vendored
2
testdata/bin/generate-schema-statements.py
vendored
@@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env impala-python
|
||||
#!/usr/bin/env impala-python3
|
||||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
|
||||
2
testdata/bin/generate-test-vectors.py
vendored
2
testdata/bin/generate-test-vectors.py
vendored
@@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env impala-python
|
||||
#!/usr/bin/env impala-python3
|
||||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
|
||||
2
testdata/bin/load-tpc-kudu.py
vendored
2
testdata/bin/load-tpc-kudu.py
vendored
@@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env impala-python
|
||||
#!/usr/bin/env impala-python3
|
||||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
|
||||
2
testdata/bin/load_nested.py
vendored
2
testdata/bin/load_nested.py
vendored
@@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env impala-python
|
||||
#!/usr/bin/env impala-python3
|
||||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
|
||||
2
testdata/bin/random_avro_schema.py
vendored
2
testdata/bin/random_avro_schema.py
vendored
@@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env impala-python
|
||||
#!/usr/bin/env impala-python3
|
||||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
|
||||
2
testdata/bin/rewrite-iceberg-metadata.py
vendored
2
testdata/bin/rewrite-iceberg-metadata.py
vendored
@@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env impala-python
|
||||
#!/usr/bin/env impala-python3
|
||||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
|
||||
2
testdata/bin/wait-for-hiveserver2.py
vendored
2
testdata/bin/wait-for-hiveserver2.py
vendored
@@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env impala-python
|
||||
#!/usr/bin/env impala-python3
|
||||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
|
||||
2
testdata/bin/wait-for-metastore.py
vendored
2
testdata/bin/wait-for-metastore.py
vendored
@@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env impala-python
|
||||
#!/usr/bin/env impala-python3
|
||||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env python
|
||||
#!/usr/bin/env python3
|
||||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env python
|
||||
#!/usr/bin/env python3
|
||||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env python
|
||||
#!/usr/bin/env python3
|
||||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
|
||||
2
testdata/common/text_delims_table.py
vendored
2
testdata/common/text_delims_table.py
vendored
@@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env impala-python
|
||||
#!/usr/bin/env impala-python3
|
||||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
|
||||
2
testdata/common/widetable.py
vendored
2
testdata/common/widetable.py
vendored
@@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env impala-python
|
||||
#!/usr/bin/env impala-python3
|
||||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
|
||||
@@ -61,13 +61,13 @@ package dependencies:
|
||||
Ubuntu 14.04.2 LTS
|
||||
libaio1
|
||||
|
||||
3. Ensure impala-python is working. It may be enough to simply run:
|
||||
3. Ensure impala-python3 is working. It may be enough to simply run:
|
||||
|
||||
$ impala-python
|
||||
$ impala-python3
|
||||
|
||||
Getting it working is out of scope of this document.
|
||||
|
||||
4. Run these commands to install cx_Oracle into the impala-python
|
||||
4. Run these commands to install cx_Oracle into the impala-python3
|
||||
virtual environment:
|
||||
|
||||
$ source "${IMPALA_HOME}"/infra/python/env-gcc${IMPALA_GCC_VERSION}/bin/activate
|
||||
|
||||
@@ -31,13 +31,10 @@ from warnings import filterwarnings
|
||||
|
||||
from tests.comparison import db_connection
|
||||
from tests.comparison.cluster import (
|
||||
CmCluster,
|
||||
DEFAULT_HIVE_HOST,
|
||||
DEFAULT_HIVE_PASSWORD,
|
||||
DEFAULT_HIVE_PORT,
|
||||
DEFAULT_HIVE_USER,
|
||||
CM_CLEAR_PORT,
|
||||
CM_TLS_PORT,
|
||||
MiniCluster,
|
||||
MiniHiveCluster,
|
||||
)
|
||||
@@ -115,7 +112,6 @@ def add_db_name_option(parser):
|
||||
|
||||
def add_cluster_options(parser):
|
||||
add_minicluster_options(parser)
|
||||
add_cm_options(parser)
|
||||
add_ssh_options(parser)
|
||||
parser.add_argument(
|
||||
'--hadoop-user-name', default=getuser(),
|
||||
@@ -146,33 +142,6 @@ def add_minicluster_options(parser):
|
||||
help='The number of impalads in the mini cluster.')
|
||||
|
||||
|
||||
def add_cm_options(parser):
|
||||
parser.add_argument(
|
||||
'--cm-host', metavar='host name',
|
||||
help='The host name of the CM server.')
|
||||
# IMPALA-5455: --cm-port defaults to None so that --use-tls can later influence the
|
||||
# default value of --cm-port: it needs to default to 7180, or 7183 if --use-tls is
|
||||
# included.
|
||||
parser.add_argument(
|
||||
'--cm-port', default=None, type=int, metavar='port number',
|
||||
help='Override the CM port. Defaults to {clear}, or {tls} with --use-tls'.format(
|
||||
clear=CM_CLEAR_PORT,
|
||||
tls=CM_TLS_PORT))
|
||||
parser.add_argument(
|
||||
'--cm-user', default="admin", metavar='user name',
|
||||
help='The name of the CM user.')
|
||||
parser.add_argument(
|
||||
'--cm-password', default="admin", metavar='password',
|
||||
help='The password for the CM user.')
|
||||
parser.add_argument(
|
||||
'--cm-cluster-name', metavar='name',
|
||||
help='If CM manages multiple clusters, use this to specify which cluster to use.')
|
||||
parser.add_argument(
|
||||
'--use-tls', action='store_true', default=False,
|
||||
help='Whether to communicate with CM using TLS. This alters the default CM port '
|
||||
'from {clear} to {tls}'.format(clear=CM_CLEAR_PORT, tls=CM_TLS_PORT))
|
||||
|
||||
|
||||
def add_ssl_options(parser):
|
||||
group = parser.add_argument_group('SSL Options')
|
||||
group.add_argument(
|
||||
@@ -185,12 +154,7 @@ def add_ssl_options(parser):
|
||||
|
||||
|
||||
def create_cluster(args):
|
||||
if args.cm_host:
|
||||
cluster = CmCluster(
|
||||
args.cm_host, port=args.cm_port, user=args.cm_user, password=args.cm_password,
|
||||
cluster_name=args.cm_cluster_name, ssh_user=args.ssh_user, ssh_port=args.ssh_port,
|
||||
ssh_key_file=args.ssh_key_file, use_tls=args.use_tls)
|
||||
elif args.use_hive:
|
||||
if args.use_hive:
|
||||
cluster = MiniHiveCluster(args.hive_host, args.hive_port)
|
||||
else:
|
||||
cluster = MiniCluster(args.hive_host, args.hive_port, args.minicluster_num_impalads)
|
||||
|
||||
@@ -48,13 +48,6 @@ try:
|
||||
except ImportError:
|
||||
from urlparse import urlparse
|
||||
|
||||
try:
|
||||
from cm_api.api_client import ApiResource as CmApiResource
|
||||
except ImportError:
|
||||
# If the cm_api module is not available, we will not be able to use Cloudera Manager.
|
||||
# This is fine for local testing.
|
||||
pass
|
||||
|
||||
from tests.comparison.db_connection import HiveConnection, ImpalaConnection
|
||||
from tests.common.environ import HIVE_MAJOR_VERSION
|
||||
from tests.common.errors import Timeout
|
||||
@@ -70,9 +63,6 @@ DEFAULT_HIVE_PASSWORD = 'hive'
|
||||
|
||||
DEFAULT_TIMEOUT = 300
|
||||
|
||||
CM_CLEAR_PORT = 7180
|
||||
CM_TLS_PORT = 7183
|
||||
|
||||
|
||||
class Cluster(with_metaclass(ABCMeta, object)):
|
||||
"""This is a base class for clusters. Cluster classes provide various methods for
|
||||
@@ -254,129 +244,6 @@ class MiniHiveCluster(MiniCluster):
|
||||
return os.environ["HIVE_CONF_DIR"]
|
||||
|
||||
|
||||
class CmCluster(Cluster):
|
||||
|
||||
def __init__(self, host_name, port=None, user="admin", password="admin",
|
||||
cluster_name=None, ssh_user=None, ssh_port=None, ssh_key_file=None,
|
||||
use_tls=False):
|
||||
# Initialize strptime() to workaround https://bugs.python.org/issue7980. Apparently
|
||||
# something in the CM API uses strptime().
|
||||
strptime("2015", "%Y")
|
||||
|
||||
Cluster.__init__(self)
|
||||
# IMPALA-5455: If the caller doesn't specify port, default it based on use_tls
|
||||
if port is None:
|
||||
if use_tls:
|
||||
port = CM_TLS_PORT
|
||||
else:
|
||||
port = CM_CLEAR_PORT
|
||||
self.cm = CmApiResource(host_name, server_port=port, username=user, password=password,
|
||||
use_tls=use_tls)
|
||||
clusters = self.cm.get_all_clusters()
|
||||
if not clusters:
|
||||
raise Exception("No clusters found in CM at %s" % host_name)
|
||||
if cluster_name:
|
||||
clusters_by_name = dict((c.name, c) for c in clusters)
|
||||
if cluster_name not in clusters_by_name:
|
||||
raise Exception(("No clusters named %s found in CM at %s."
|
||||
"Available clusters are %s.")
|
||||
% (cluster_name, host_name, ", ".join(sorted(clusters_by_name.keys()))))
|
||||
self.cm_cluster = clusters_by_name[cluster_name]
|
||||
else:
|
||||
if len(clusters) > 1:
|
||||
raise Exception(("Too many clusters found in CM at %s;"
|
||||
" a cluster name must be provided")
|
||||
% host_name)
|
||||
self.cm_cluster = clusters[-1]
|
||||
|
||||
self.ssh_user = ssh_user
|
||||
self.ssh_port = ssh_port
|
||||
self.ssh_key_file = ssh_key_file
|
||||
self._ssh_client_lock = Lock()
|
||||
self._ssh_clients_by_host_name = defaultdict(list)
|
||||
|
||||
def shell(self, cmd, host_name, timeout_secs=DEFAULT_TIMEOUT):
|
||||
with self._ssh_client(host_name) as client:
|
||||
return client.shell(cmd, timeout_secs=timeout_secs)
|
||||
|
||||
@contextmanager
|
||||
def _ssh_client(self, host_name):
|
||||
"""Returns an SSH client for use in a 'with' block. When the 'with' context exits,
|
||||
the client will be kept for reuse.
|
||||
"""
|
||||
with self._ssh_client_lock:
|
||||
clients = self._ssh_clients_by_host_name[host_name]
|
||||
if clients:
|
||||
client = clients.pop()
|
||||
else:
|
||||
# IMPALA-7460: Insulate this import away from the global context so as to avoid
|
||||
# requiring Paramiko unless it's absolutely needed.
|
||||
from tests.util.ssh_util import SshClient
|
||||
LOG.debug("Creating new SSH client for %s", host_name)
|
||||
client = SshClient()
|
||||
client.connect(host_name, username=self.ssh_user, key_filename=self.ssh_key_file)
|
||||
error_occurred = False
|
||||
try:
|
||||
yield client
|
||||
except Exception:
|
||||
error_occurred = True
|
||||
raise
|
||||
finally:
|
||||
if not error_occurred:
|
||||
with self._ssh_client_lock:
|
||||
self._ssh_clients_by_host_name[host_name].append(client)
|
||||
|
||||
def _init_local_hadoop_conf_dir(self):
|
||||
self._local_hadoop_conf_dir = mkdtemp(prefix='impala_mini_hive_cluster_')
|
||||
data = BytesIO(self.cm.get("/clusters/%s/services/%s/clientConfig"
|
||||
% (self.cm_cluster.name, self._find_service("HIVE").name)))
|
||||
zip_file = ZipFile(data)
|
||||
for name in zip_file.namelist():
|
||||
if name.endswith("/"):
|
||||
continue
|
||||
extract_path = os.path.join(self._local_hadoop_conf_dir, os.path.basename(name))
|
||||
with open(extract_path, "w") as conf_file:
|
||||
conf_file.write(zip_file.open(name).read())
|
||||
|
||||
def _find_service(self, service_type):
|
||||
"""Find a service by its CM API service type. An exception will be raised if no
|
||||
service is found or multiple services are found. See the CM API documentation for
|
||||
more details about the service type.
|
||||
"""
|
||||
services = [s for s in self.cm_cluster.get_all_services() if s.type == service_type]
|
||||
if not services:
|
||||
raise Exception("No service of type %s found in cluster %s"
|
||||
% (service_type, self.cm_cluster.name))
|
||||
if len(services) > 1:
|
||||
raise Exception("Found %s services in cluster %s; only one is expected."
|
||||
% len(services, self.cm_cluster.name))
|
||||
return services[0]
|
||||
|
||||
def _find_role(self, role_type, service_type):
|
||||
"""Find a role by its CM API role and service type. An exception will be raised if
|
||||
no roles are found. See the CM API documentation for more details about the
|
||||
service and role types.
|
||||
"""
|
||||
service = self._find_service(service_type)
|
||||
roles = service.get_roles_by_type(role_type)
|
||||
if not roles:
|
||||
raise Exception("No roles of type %s found in service %s"
|
||||
% (role_type, service.name))
|
||||
return roles[0]
|
||||
|
||||
def _init_hdfs(self):
|
||||
self._hdfs = Hdfs(self, "hdfs")
|
||||
|
||||
def _init_hive(self):
|
||||
hs2 = self._find_role("HIVESERVER2", "HIVE")
|
||||
host = self.cm.get_host(hs2.hostRef.hostId)
|
||||
config = hs2.get_config(view="full")["hs2_thrift_address_port"]
|
||||
self._hive = Hive(self, str(host.hostname), int(config.value or config.default))
|
||||
|
||||
def _init_impala(self):
|
||||
self._impala = CmImpala(self, self._find_service("IMPALA"))
|
||||
|
||||
|
||||
class Service(object):
|
||||
"""This is a base class for cluster services such as HDFS. Service classes will provide
|
||||
an interface for interacting with the service.
|
||||
@@ -646,23 +513,6 @@ class Impala(Service):
|
||||
raise NotImplementedError()
|
||||
|
||||
|
||||
class CmImpala(Impala):
|
||||
|
||||
def __init__(self, cluster, cm_api):
|
||||
super(CmImpala, self).__init__(cluster,
|
||||
[CmImpalad(i) for i in cm_api.get_roles_by_type("IMPALAD")])
|
||||
self._api = cm_api
|
||||
|
||||
def restart(self):
|
||||
LOG.info("Restarting Impala")
|
||||
command = self._api.restart()
|
||||
command = command.wait(timeout=(60 * 15))
|
||||
if command.active:
|
||||
raise Timeout("Timeout waiting for Impala to restart")
|
||||
if not command.success:
|
||||
raise Exception("Failed to restart Impala: %s" % command.resultMessage)
|
||||
|
||||
|
||||
class Impalad(with_metaclass(ABCMeta, object)):
|
||||
|
||||
def __init__(self):
|
||||
@@ -724,7 +574,7 @@ class Impalad(with_metaclass(ABCMeta, object)):
|
||||
echo Could not find a running impalad >&2
|
||||
exit 1
|
||||
fi
|
||||
cat /proc/$PID/cmdline""").split(b"\0")[0]
|
||||
cat /proc/$PID/cmdline""").split("\0")[0]
|
||||
|
||||
def find_last_crash_message(self, start_time):
|
||||
"""Returns a string with various info (backtrace and log messages) if any is found."""
|
||||
@@ -884,52 +734,3 @@ class MiniClusterImpalad(Impalad):
|
||||
|
||||
def find_core_dump_dir(self):
|
||||
raise NotImplementedError()
|
||||
|
||||
|
||||
class CmImpalad(Impalad):
|
||||
|
||||
def __init__(self, cm_api):
|
||||
super(CmImpalad, self).__init__()
|
||||
self._api = cm_api
|
||||
self._host_name = None
|
||||
self._hs2_port = None
|
||||
self._web_ui_port = None
|
||||
|
||||
@property
|
||||
def host_name(self):
|
||||
if not self._host_name:
|
||||
self._host_name = str(self.cluster.cm.get_host(self._api.hostRef.hostId).hostname)
|
||||
return self._host_name
|
||||
|
||||
@property
|
||||
def hs2_port(self):
|
||||
if not self._hs2_port:
|
||||
self._hs2_port = self._get_cm_config("hs2_port", value_type=int)
|
||||
return self._hs2_port
|
||||
|
||||
@property
|
||||
def web_ui_port(self):
|
||||
if not self._web_ui_port:
|
||||
self._web_ui_port = self._get_cm_config("impalad_webserver_port", value_type=int)
|
||||
return self._web_ui_port
|
||||
|
||||
def find_pid(self):
|
||||
# Get the oldest pid. In a keberized cluster, occasionally two pids could be
|
||||
# found if -o isn't used. Presumably the second pid is the kerberos ticket
|
||||
# renewer.
|
||||
pid = self.shell("pgrep -o impalad || true")
|
||||
if pid:
|
||||
return int(pid)
|
||||
|
||||
def find_process_mem_mb_limit(self):
|
||||
return self._get_cm_config("impalad_memory_limit", value_type=int) // 1024 ** 2
|
||||
|
||||
def find_core_dump_dir(self):
|
||||
return self._get_cm_config("core_dump_dir")
|
||||
|
||||
def _get_cm_config(self, config, value_type=None):
|
||||
config = self._api.get_config(view="full")[config]
|
||||
value = config.value or config.default
|
||||
if value_type:
|
||||
return value_type(value)
|
||||
return value
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env impala-python
|
||||
#!/usr/bin/env impala-python3
|
||||
|
||||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
@@ -223,7 +223,7 @@ class DbPopulator(object):
|
||||
reducer_count += (table_data_generator.row_count
|
||||
// estimate_rows_per_reducer(table_data_generator, MB_PER_REDUCER)) + 1
|
||||
mapper_input_data.append(serialize(table_data_generator))
|
||||
hdfs.write(mapper_input_file, data='\n'.join(mapper_input_data))
|
||||
hdfs.write(mapper_input_file, data=b'\n'.join(mapper_input_data))
|
||||
|
||||
files = ['common.py', 'db_types.py', 'data_generator_mapred_common.py',
|
||||
'data_generator_mapper.py', 'data_generator_reducer.py',
|
||||
|
||||
2
tests/comparison/data_generator_mapper.py
Executable file → Normal file
2
tests/comparison/data_generator_mapper.py
Executable file → Normal file
@@ -1,5 +1,3 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
# distributed with this work for additional information
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
'''
|
||||
|
||||
from __future__ import absolute_import, division, print_function
|
||||
from base import range
|
||||
from builtins import range
|
||||
import base64
|
||||
import pickle
|
||||
from io import BytesIO
|
||||
@@ -71,8 +71,9 @@ class TextTableDataGenerator(object):
|
||||
# has a terminator. Impala and Hive accept this format with the option
|
||||
# 'ROW FORMAT DELIMITED'.
|
||||
self.output_file.write(b"\x01")
|
||||
self.output_file.write(str(col_val_buffers[col_idx][val_buffer_idx]))
|
||||
self.output_file.write("\n")
|
||||
self.output_file.write(
|
||||
str(col_val_buffers[col_idx][val_buffer_idx]).encode('utf-8'))
|
||||
self.output_file.write("\n".encode('utf-8'))
|
||||
|
||||
def _create_val_generator(self, val_type):
|
||||
val_generator = RandomValGenerator().create_val_generator(val_type)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env impala-python
|
||||
#!/usr/bin/env impala-python3
|
||||
|
||||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env impala-python
|
||||
#!/usr/bin/env impala-python3
|
||||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env impala-python
|
||||
#!/usr/bin/env impala-python3
|
||||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
|
||||
@@ -4,7 +4,7 @@ This directory contains tests for the Random Query Generator.
|
||||
|
||||
How-to
|
||||
|
||||
To run the tests we assume you have an impala-python environment already
|
||||
To run the tests we assume you have an impala-python3 environment already
|
||||
set up. Then:
|
||||
|
||||
$ cd "${IMPALA_HOME}"/tests/comparison/tests
|
||||
|
||||
@@ -19,7 +19,7 @@ from __future__ import absolute_import, division, print_function
|
||||
import pytest
|
||||
|
||||
from tests.comparison import cli_options
|
||||
from tests.comparison.cluster import CmCluster, MiniCluster
|
||||
from tests.comparison.cluster import MiniCluster
|
||||
|
||||
|
||||
__cluster = None
|
||||
@@ -27,20 +27,12 @@ __cluster = None
|
||||
def pytest_addoption(parser):
|
||||
if not hasattr(parser, "add_argument"):
|
||||
parser.add_argument = parser.addoption
|
||||
cli_options.add_cm_options(parser)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def cluster(request):
|
||||
global __cluster
|
||||
if not __cluster:
|
||||
cm_host = get_option_value(request, "cm_host")
|
||||
if cm_host:
|
||||
__cluster = CmCluster(cm_host, port=get_option_value(request, "cm_port"),
|
||||
user=get_option_value(request, "cm_user"),
|
||||
password=get_option_value(request, "cm_password"),
|
||||
cluster_name=get_option_value(request, "cm_cluster_name"))
|
||||
else:
|
||||
__cluster = MiniCluster()
|
||||
return __cluster
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env impala-python
|
||||
#!/usr/bin/env impala-python3
|
||||
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
@@ -18,7 +18,7 @@
|
||||
# under the License.
|
||||
|
||||
# This is a script that allows a tester to test his Oracle setup and cx_Oracle
|
||||
# installation within his impala-python environment. It's meant to be super simple. The
|
||||
# installation within his impala-python3 environment. It's meant to be super simple. The
|
||||
# emphasis here is on a cx_Oracle connection and cursor with no other distractions, even
|
||||
# command line option parsing/handling. Modify the constants below and run:
|
||||
#
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
#!/usr/bin/env impala-python
|
||||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
# distributed with this work for additional information
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
#!/usr/bin/env impala-python
|
||||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
# distributed with this work for additional information
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
#!/usr/bin/env impala-python
|
||||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
# distributed with this work for additional information
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
#!/usr/bin/env impala-python
|
||||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
# distributed with this work for additional information
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
#!/usr/bin/env impala-python
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
#!/usr/bin/env impala-python
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
#!/usr/bin/env impala-python
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
#!/usr/bin/env impala-python
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
#!/usr/bin/env impala-python
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
#!/usr/bin/env impala-python
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
#!/usr/bin/env impala-python
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
#!/usr/bin/env impala-python
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
#!/usr/bin/env impala-python
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
#!/usr/bin/env impala-python
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env impala-python
|
||||
#!/usr/bin/env impala-python3
|
||||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env impala-python
|
||||
#!/usr/bin/env impala-python3
|
||||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
#!/usr/bin/env impala-python
|
||||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
# distributed with this work for additional information
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
#!/usr/bin/env impala-python
|
||||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
# distributed with this work for additional information
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env impala-python
|
||||
#!/usr/bin/env impala-python3
|
||||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
#!/usr/bin/env impala-python
|
||||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
# distributed with this work for additional information
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
#!/usr/bin/env impala-python
|
||||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
# distributed with this work for additional information
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
#!/usr/bin/env impala-python
|
||||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
# distributed with this work for additional information
|
||||
|
||||
@@ -56,8 +56,8 @@ hostname = 'localhost'
|
||||
# Utility class for interacting with Hive ACID transactions.
|
||||
# It's basically a facade, i.e. it provides a simplified interface for HMS.
|
||||
#
|
||||
# You can also use it interactively from impala-python, e.g.:
|
||||
# $> impala-python
|
||||
# You can also use it interactively from impala-python3, e.g.:
|
||||
# $> impala-python3
|
||||
# >>> from tests.util.acid_txn import AcidTxn
|
||||
# >>> at = AcidTxn()
|
||||
# >>> at.get_open_txns()
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user