hive-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hashut...@apache.org
Subject svn commit: r1543567 - /hive/trunk/bin/hive
Date Tue, 19 Nov 2013 20:44:21 GMT
Author: hashutosh
Date: Tue Nov 19 20:44:21 2013
New Revision: 1543567

URL: http://svn.apache.org/r1543567
Log:
HIVE-2055 : Hive should add HBase classpath dependencies when available (Nick Dimiduk via
Ashutosh Chauhan)

Modified:
    hive/trunk/bin/hive

Modified: hive/trunk/bin/hive
URL: http://svn.apache.org/viewvc/hive/trunk/bin/hive?rev=1543567&r1=1543566&r2=1543567&view=diff
==============================================================================
--- hive/trunk/bin/hive (original)
+++ hive/trunk/bin/hive Tue Nov 19 20:44:21 2013
@@ -196,6 +196,39 @@ if [ "$hadoop_major_ver" -lt "1" -a  "$h
     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}"
+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 2>/dev/null)"}
+
+# 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>/dev/null | 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
+
 if [ "${AUX_PARAM}" != "" ]; then
   HIVE_OPTS="$HIVE_OPTS -hiveconf hive.aux.jars.path=${AUX_PARAM}"
   AUX_JARS_CMD_LINE="-libjars ${AUX_PARAM}"



Mime
View raw message