C++ Java Python JavaScript C Shell Other
Clone or download
toddlipcon IMPALA-7388. Fix issues in and optimize various Status macros
Prior to this patch, the JNI THROW_IF macros used a variable 'status' in
local scope to hold the result of the statement whose status is to be
checked. This could cause problems if there is another variable 'status'
in the external scope, as the inner scope would shadow the outer. For

  Status status = foo();
  THROW_IF_ERROR(status, ...);

... would actually end up resulting in a macro expansion like:

  do {
    Status status = status;
  } while (false);

Suprisingly, such code is legal C++ and ends up calling the Status copy
constructor with an uninitialized version of itself as the argument. gcc
doesn't seem to emit a warning for this construct, though clang does
emit "variable 'status' is uninitialized when used within its own

If such code is emitted, we'll get undefined behavior and most likely
not end up throwing an error even if status is not OK.

The fix is simple: use a less-likely-to-conflict variable name _status
in the macro. This also fixes other macros that previously used
__status__ to use _status to align with the fact that __*__ style
keywords are reserved by the C++ standard.

Additionally, this patch changes some other similar macros to use const
references instead of creating new variables. On the surface, it might
look wrong to assign a const reference to a temporary such as the result
of a function call. However, C++ explicitly allows this and ensures that
the lifetime of the temporary is extended to the lifetime of the
captured reference, making it safe[1]. This acts as a small optimization
since the RETURN_IF_ERROR macros won't call their copy-constructor an
extra time.

[1] https://herbsutter.com/2008/01/01/gotw-88-a-candidate-for-the-most-important-const/

Change-Id: I3d62c99bbd83cc290f5992077258af156eaa6330
Reviewed-on: http://gerrit.cloudera.org:8080/11153
Tested-by: Impala Public Jenkins <impala-public-jenkins@cloudera.com>
Reviewed-by: Todd Lipcon <todd@apache.org>
Latest commit ea615d1 Aug 2, 2018
Failed to load latest commit information.
be IMPALA-7388. Fix issues in and optimize various Status macros Aug 14, 2018
bin Make collect_diagnostics executable and minor argument-parsing changes. Aug 14, 2018
cmake_modules Bump toolchain version, include libunwind Jul 6, 2018
common IMPALA-7398: Add logged_in_user alias for effective_user Aug 11, 2018
docker IMPALA-7390: Configure /etc/hosts to avoid rpc-mgr-kerberized-test is… Aug 8, 2018
docs IMPALA-7400: [DOCS] Updated outdated contents from impala_porting Aug 8, 2018
ext-data-source Use "mvn -B" in builds to avoid dowloading progress bars in logs. Mar 27, 2018
fe IMPALA-7419: Fix NullPointerException in SimplifyConditionalsRule Aug 14, 2018
impala-parent IMPALA-7329: Blacklist CDH Maven snapshots repository Jul 31, 2018
infra IMPALA-7199: Add scripts to create code coverage reports Jul 17, 2018
lib/python IMPALA-7399: Add script in lib/python to generate junit XML. Aug 9, 2018
security KUDU-2305: Limit sidecars to INT_MAX and fortify socket code Mar 22, 2018
shell IMPALA-6335. Allow most shell tests to run in parallel Aug 8, 2018
ssh_keys Move ssh keys from bin directory to fix packaging build break Jan 8, 2014
testdata IMPALA-7347: Ignore numFilesErasureCoded in TestShowCreateTable Aug 13, 2018
tests IMPALA-7347: Ignore numFilesErasureCoded in TestShowCreateTable Aug 13, 2018
www IMPALA-6034: Add scanned bytes limits per query Aug 9, 2018
.clang-format Match .clang-format more closely to actual practice. Oct 14, 2016
.clang-tidy IMPALA-3675: part 1: -Werror for ASAN Jul 23, 2018
.gitignore IMPALA-7381: Prevent build failure after switching to new CDH_BUILD_N… Aug 3, 2018
CMakeLists.txt IMPALA-4669: [KUTIL] Add kudu_util library to the build. Jul 12, 2018
EXPORT_CONTROL.md IMPALA-4406: Add cryptography export control notice Nov 4, 2016
LICENSE.txt IMPALA-4669: [KUTIL] Add kudu_util library to the build. Jul 12, 2018
LOGS.md Consolidate test and cluster logs under a single directory. Mar 28, 2016
NOTICE.txt Update copyright date to 2018. Jan 12, 2018
README.md IMPALA-7381: Prevent build failure after switching to new CDH_BUILD_N… Aug 3, 2018
buildall.sh IMPALA-7381: Prevent build failure after switching to new CDH_BUILD_N… Aug 3, 2018
setup.cfg Ignore flake8 W503 about breaking before operators Aug 13, 2018


Welcome to Impala

Lightning-fast, distributed SQL queries for petabytes of data stored in Apache Hadoop clusters.

Impala is a modern, massively-distributed, massively-parallel, C++ query engine that lets you analyze, transform and combine data from a variety of data sources:

  • Best of breed performance and scalability.
  • Support for data stored in HDFS, Apache HBase and Amazon S3.
  • Wide analytic SQL support, including window functions and subqueries.
  • On-the-fly code generation using LLVM to generate CPU-efficient code tailored specifically to each individual query.
  • Support for the most commonly-used Hadoop file formats, including the Apache Parquet project.
  • Apache-licensed, 100% open source.

More about Impala

To learn more about Impala as a business user, or to try Impala live or in a VM, please visit the Impala homepage.

If you are interested in contributing to Impala as a developer, or learning more about Impala's internals and architecture, visit the Impala wiki.

Supported Platforms

Impala only supports Linux at the moment.

Export Control Notice

This distribution uses cryptographic software and may be subject to export controls. Please refer to EXPORT_CONTROL.md for more information.

Build Instructions

See bin/bootstrap_build.sh.

Detailed Build Notes

Impala can be built with pre-built components, downloaded from S3, or can be built with an in-place toolchain located in the thirdparty directory (not recommended). The components needed to build Impala are Apache Hadoop, Hive, HBase, and Sentry. If you need to manually override the locations or versions of these components, you can do so through the environment variables and scripts listed below.

Scripts and directories
Location Purpose
bin/impala-config.sh This script must be sourced to setup all environment variables properly to allow other scripts to work
bin/impala-config-local.sh A script can be created in this location to set local overrides for any environment variables
bin/impala-config-branch.sh A version of the above that can be checked into a branch for convenience.
bin/bootstrap_build.sh A helper script to bootstrap some of the build requirements.
bin/bootstrap_development.sh A helper script to bootstrap a developer environment. Please read it before using.
be/build/ Impala build output goes here.
be/generated-sources/ Thrift and other generated source will be found here.
Build Related Variables
Environment variable Default value Description
IMPALA_HOME Top level Impala directory
IMPALA_TOOLCHAIN "${IMPALA_HOME}/toolchain" Native toolchain directory (for compilers, libraries, etc.)
SKIP_TOOLCHAIN_BOOTSTRAP "false" Skips downloading the toolchain any python dependencies if "true"
CDH_BUILD_NUMBER Identifier to indicate the CDH build number
CDH_COMPONENTS_HOME "${IMPALA_HOME}/toolchain/cdh_components-${CDH_BUILD_NUMBER}" OR "${IMPALA_HOME}/thirdparty" (if detected) If a thirdparty directory is present, components found here will override anything in IMPALA_TOOLCHAIN.
CDH_MAJOR_VERSION "5" Identifier used to uniqueify paths for potentially incompatible component builds.
IMPALA_CONFIG_SOURCED "1" Set by ${IMPALA_HOME}/bin/impala-config.sh (internal use)
JAVA_HOME "/usr/lib/jvm/${JAVA_VERSION}" Used to locate Java
JAVA_VERSION "java-7-oracle-amd64" Can override to set a local Java version.
JAVA "${JAVA_HOME}/bin/java" Java binary location.
CLASSPATH See bin/set-classpath.sh for details.
PYTHONPATH Will be changed to include: "${IMPALA_HOME}/shell/gen-py" "${IMPALA_HOME}/testdata" "${THRIFT_HOME}/python/lib/python2.7/site-packages" "${HIVE_HOME}/lib/py" "${IMPALA_HOME}/shell/ext-py/prettytable-0.7.1/dist/prettytable-0.7.1" "${IMPALA_HOME}/shell/ext-py/sasl-0.1.1/dist/sasl-0.1.1-py2.7-linux-x "${IMPALA_HOME}/shell/ext-py/sqlparse-0.1.19/dist/sqlparse-0.1.19-py2
Source Directories for Impala
Environment variable Default value Description
IMPALA_BE_DIR "${IMPALA_HOME}/be" Backend directory. Build output is also stored here.
IMPALA_FE_DIR "${IMPALA_HOME}/fe" Frontend directory
IMPALA_COMMON_DIR "${IMPALA_HOME}/common" Common code (thrift, function registry)
Various Compilation Settings
Environment variable Default value Description
IMPALA_BUILD_THREADS "8" or set to number of processors by default. Used for make -j and distcc -j settings.
IMPALA_MAKE_FLAGS "" Any extra settings to pass to make. Also used when copying udfs / udas into HDFS.
USE_SYSTEM_GCC "0" If set to any other value, directs cmake to not set GCC_ROOT, CMAKE_C_COMPILER, CMAKE_CXX_COMPILER, as well as setting TOOLCHAIN_LINK_FLAGS
IMPALA_CXX_COMPILER "default" Used by cmake (cmake_modules/toolchain and clang_toolchain.cmake) to select gcc / clang
USE_GOLD_LINKER "true" Directs backend cmake to use gold.
IS_OSX "false" (Experimental) currently only used to disable Kudu.
Environment variable Default value Description
HADOOP_INCLUDE_DIR "${HADOOP_HOME}/include" For 'hdfs.h'
HADOOP_LIB_DIR "${HADOOP_HOME}/lib" For 'libhdfs.a' or 'libhdfs.so'
HIVE_SRC_DIR "${HIVE_HOME}/src" Used to find Hive thrift files.