You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by se...@apache.org on 2016/11/15 20:20:38 UTC
[06/50] [abbrv] hive git commit: HIVE-15108 : allow Hive script to
skip hadoop version check and HBase classpath (Sergey Shelukhin,
reviewed by Gopal V)
HIVE-15108 : allow Hive script to skip hadoop version check and HBase classpath (Sergey Shelukhin, reviewed by Gopal V)
Project: http://git-wip-us.apache.org/repos/asf/hive/repo
Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/f4598fbb
Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/f4598fbb
Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/f4598fbb
Branch: refs/heads/hive-14535
Commit: f4598fbbd4e1de022586ed96dea4f56a51c87fa4
Parents: 8571170
Author: Sergey Shelukhin <se...@apache.org>
Authored: Thu Nov 10 12:09:00 2016 -0800
Committer: Sergey Shelukhin <se...@apache.org>
Committed: Thu Nov 10 12:21:30 2016 -0800
----------------------------------------------------------------------
bin/hive | 133 +++++++++++++++++++++++++++++++++-------------------------
1 file changed, 76 insertions(+), 57 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hive/blob/f4598fbb/bin/hive
----------------------------------------------------------------------
diff --git a/bin/hive b/bin/hive
index 3b9f3e0..81ef673 100755
--- a/bin/hive
+++ b/bin/hive
@@ -29,6 +29,10 @@ TMP_USER_DIR="/tmp/${USER}"
STDERR="${TMP_USER_DIR}/stderr"
SERVICE=""
HELP=""
+SKIP_HBASECP=false
+SKIP_HADOOPVERSION=false
+
+SERVICE_ARGS=()
while [ $# -gt 0 ]; do
case "$1" in
--version)
@@ -52,6 +56,14 @@ while [ $# -gt 0 ]; do
SERVICE=llapdump
shift
;;
+ --skiphadoopversion)
+ SKIP_HADOOPVERSION=true
+ shift
+ ;;
+ --skiphbasecp)
+ SKIP_HBASECP=true
+ shift
+ ;;
--help)
HELP=_help
shift
@@ -61,7 +73,8 @@ while [ $# -gt 0 ]; do
shift
;;
*)
- break
+ SERVICE_ARGS=("${SERVICE_ARGS[@]}" "$1")
+ shift
;;
esac
done
@@ -215,64 +228,68 @@ if [ "${STDERR}" != "/dev/null" ] && [ ! -f ${STDERR} ]; then
fi
fi
-# Make sure we're using a compatible version of Hadoop
-if [ "x$HADOOP_VERSION" == "x" ]; then
- HADOOP_VERSION=$($HADOOP version 2>> ${STDERR} | awk -F"\t" '/Hadoop/ {print $0}' | cut -d' ' -f 2);
-fi
-
-# Save the regex to a var to workaround quoting incompatabilities
-# between Bash 3.1 and 3.2
-hadoop_version_re="^([[:digit:]]+)\.([[:digit:]]+)(\.([[:digit:]]+))?.*$"
-
-if [[ "$HADOOP_VERSION" =~ $hadoop_version_re ]]; then
- hadoop_major_ver=${BASH_REMATCH[1]}
- hadoop_minor_ver=${BASH_REMATCH[2]}
- hadoop_patch_ver=${BASH_REMATCH[4]}
-else
- echo "Unable to determine Hadoop version information."
- echo "'hadoop version' returned:"
- echo `$HADOOP version`
- exit 5
-fi
-
-if [ "$hadoop_major_ver" -lt "1" -a "$hadoop_minor_ver$hadoop_patch_ver" -lt "201" ]; then
- echo "Hive requires Hadoop 0.20.x (x >= 1)."
- echo "'hadoop version' returned:"
- echo `$HADOOP version`
- exit 6
-fi
-
-# HBase detection. Need bin/hbase and a conf dir for building classpath entries.
-# Start with BigTop defaults for HBASE_HOME and HBASE_CONF_DIR.
-HBASE_HOME=${HBASE_HOME:-"/usr/lib/hbase"}
-HBASE_CONF_DIR=${HBASE_CONF_DIR:-"/etc/hbase/conf"}
-if [[ ! -d $HBASE_CONF_DIR ]] ; then
- # not explicitly set, nor in BigTop location. Try looking in HBASE_HOME.
- HBASE_CONF_DIR="$HBASE_HOME/conf"
-fi
-
-# perhaps we've located the HBase config. if so, include it on classpath.
-if [[ -d $HBASE_CONF_DIR ]] ; then
- export HADOOP_CLASSPATH="${HADOOP_CLASSPATH}:${HBASE_CONF_DIR}"
+if [ "$SKIP_HADOOPVERSION" = false ]; then
+ # Make sure we're using a compatible version of Hadoop
+ if [ "x$HADOOP_VERSION" == "x" ]; then
+ HADOOP_VERSION=$($HADOOP version 2>> ${STDERR} | awk -F"\t" '/Hadoop/ {print $0}' | cut -d' ' -f 2);
+ fi
+
+ # Save the regex to a var to workaround quoting incompatabilities
+ # between Bash 3.1 and 3.2
+ hadoop_version_re="^([[:digit:]]+)\.([[:digit:]]+)(\.([[:digit:]]+))?.*$"
+
+ if [[ "$HADOOP_VERSION" =~ $hadoop_version_re ]]; then
+ hadoop_major_ver=${BASH_REMATCH[1]}
+ hadoop_minor_ver=${BASH_REMATCH[2]}
+ hadoop_patch_ver=${BASH_REMATCH[4]}
+ else
+ echo "Unable to determine Hadoop version information."
+ echo "'hadoop version' returned:"
+ echo `$HADOOP version`
+ exit 5
+ fi
+
+ if [ "$hadoop_major_ver" -lt "1" -a "$hadoop_minor_ver$hadoop_patch_ver" -lt "201" ]; then
+ echo "Hive requires Hadoop 0.20.x (x >= 1)."
+ echo "'hadoop version' returned:"
+ echo `$HADOOP version`
+ exit 6
+ fi
fi
-# look for the hbase script. First check HBASE_HOME and then ask PATH.
-if [[ -e $HBASE_HOME/bin/hbase ]] ; then
- HBASE_BIN="$HBASE_HOME/bin/hbase"
-fi
-HBASE_BIN=${HBASE_BIN:-"$(which hbase)"}
-
-# perhaps we've located HBase. If so, include its details on the classpath
-if [[ -n $HBASE_BIN ]] ; then
- # exclude ZK, PB, and Guava (See HIVE-2055)
- # depends on HBASE-8438 (hbase-0.94.14+, hbase-0.96.1+) for `hbase mapredcp` command
- for x in $($HBASE_BIN mapredcp 2>> ${STDERR} | tr ':' '\n') ; do
- if [[ $x == *zookeeper* || $x == *protobuf-java* || $x == *guava* ]] ; then
- continue
- fi
- # TODO: should these should be added to AUX_PARAM as well?
- export HADOOP_CLASSPATH="${HADOOP_CLASSPATH}:${x}"
- done
+if [ "$SKIP_HBASECP" = false ]; then
+ # HBase detection. Need bin/hbase and a conf dir for building classpath entries.
+ # Start with BigTop defaults for HBASE_HOME and HBASE_CONF_DIR.
+ HBASE_HOME=${HBASE_HOME:-"/usr/lib/hbase"}
+ HBASE_CONF_DIR=${HBASE_CONF_DIR:-"/etc/hbase/conf"}
+ if [[ ! -d $HBASE_CONF_DIR ]] ; then
+ # not explicitly set, nor in BigTop location. Try looking in HBASE_HOME.
+ HBASE_CONF_DIR="$HBASE_HOME/conf"
+ fi
+
+ # perhaps we've located the HBase config. if so, include it on classpath.
+ if [[ -d $HBASE_CONF_DIR ]] ; then
+ export HADOOP_CLASSPATH="${HADOOP_CLASSPATH}:${HBASE_CONF_DIR}"
+ fi
+
+ # look for the hbase script. First check HBASE_HOME and then ask PATH.
+ if [[ -e $HBASE_HOME/bin/hbase ]] ; then
+ HBASE_BIN="$HBASE_HOME/bin/hbase"
+ fi
+ HBASE_BIN=${HBASE_BIN:-"$(which hbase)"}
+
+ # perhaps we've located HBase. If so, include its details on the classpath
+ if [[ -n $HBASE_BIN ]] ; then
+ # exclude ZK, PB, and Guava (See HIVE-2055)
+ # depends on HBASE-8438 (hbase-0.94.14+, hbase-0.96.1+) for `hbase mapredcp` command
+ for x in $($HBASE_BIN mapredcp 2>> ${STDERR} | tr ':' '\n') ; do
+ if [[ $x == *zookeeper* || $x == *protobuf-java* || $x == *guava* ]] ; then
+ continue
+ fi
+ # TODO: should these should be added to AUX_PARAM as well?
+ export HADOOP_CLASSPATH="${HADOOP_CLASSPATH}:${x}"
+ done
+ fi
fi
if [ "${AUX_PARAM}" != "" ]; then
@@ -310,6 +327,7 @@ for j in $SERVICE_LIST ; do
done
# to initialize logging for all services
+
export HADOOP_CLIENT_OPTS="$HADOOP_CLIENT_OPTS -Dlog4j.configurationFile=hive-log4j2.properties "
if [ -f "${HIVE_CONF_DIR}/parquet-logging.properties" ]; then
@@ -323,5 +341,6 @@ if [ "$TORUN" = "" ] ; then
echo "Available Services: $SERVICE_LIST"
exit 7
else
+ set -- "${SERVICE_ARGS[@]}"
$TORUN "$@"
fi