Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
git clone https://github.com/apache/orc.git
cd orc
mkdir build && cd build

# Export CC and CXX to let cmake use Impala's gcc
# Note that IMPALA-9760 changes the toolchain location in Impala 4.0. Before that you should use
#   export CC="${IMPALA_HOME}/toolchain/gcc-${IMPALA_GCC_VERSION}/bin/gcc"
#   export CXX="${IMPALA_HOME}/toolchain/gcc-${IMPALA_GCC_VERSION}/bin/g++"
export CC="${IMPALA_TOOLCHAIN_PACKAGES_HOME}/gcc-${IMPALA_GCC_VERSION}/bin/gcc"
export CXX="${IMPALA_TOOLCHAIN_PACKAGES_HOME}/gcc-${IMPALA_GCC_VERSION}/bin/g++"

# Use Impala's cmake. Don't build the java lib and libhdfspp.
${IMPALA_HOME}/toolchain/cmake-${IMPALA_CMAKE_VERSION}/bin/cmake .. -DBUILD_JAVA=OFF -DBUILD_LIBHDFSPP=OFF -DINSTALL_VENDORED_LIBS=OFF
# Then compile with multi-processes. $(nproc) is the number of virtual CPU cores.
make -j $(nproc)

# If succeeds, you should be able to find the binary at c++/src/liborc.a

Link Impala with your customized ORC library

Manually replace the ORC library in Impala's toolchain dir with your customized one. Then recompile Impala. Let's say ${ORC_HOME} is where you clone the ORC repo.

Code Block
cd# Before IMPALA-9760, the location is $IMPALA_HOME/toolchain instead.
cd $IMPALA_TOOLCHAIN_PACKAGES_HOME

# Backup the existing library
cp -r orc-${IMPALA_ORC_VERSION} orc-${IMPALA_ORC_VERSION}-bak
cd orc-${IMPALA_ORC_VERSION}

# Replace the library
cp ${ORC_HOME}/build/c++/src/liborc.a lib/liborc.a
# Replace the header files
rm include/orc/*
cp ${ORC_HOME}/build/c++/include/orc/orc-config.hh include/orc/
cp ${ORC_HOME}/c++/include/orc/*.hh include/orc/
# ORC-751 adds another header subdir 'sargs'. Copy it as well.
cp -r ${ORC_HOME}/c++/include/orc/sargs include/orc/

# Recompile Impala
cd $IMPALA_HOME
make -j $(nproc) impalad

...