You are viewing a plain text version of this content. The canonical link for it is here.
Posted to hcatalog-commits@incubator.apache.org by ga...@apache.org on 2012/04/12 00:53:45 UTC

svn commit: r1325084 - in /incubator/hcatalog/branches/branch-0.4: CHANGES.txt bin/hcat

Author: gates
Date: Thu Apr 12 00:53:45 2012
New Revision: 1325084

URL: http://svn.apache.org/viewvc?rev=1325084&view=rev
Log:
HCATALOG-342 enable hcat to work with hive bigtop rpm

Modified:
    incubator/hcatalog/branches/branch-0.4/CHANGES.txt
    incubator/hcatalog/branches/branch-0.4/bin/hcat

Modified: incubator/hcatalog/branches/branch-0.4/CHANGES.txt
URL: http://svn.apache.org/viewvc/incubator/hcatalog/branches/branch-0.4/CHANGES.txt?rev=1325084&r1=1325083&r2=1325084&view=diff
==============================================================================
--- incubator/hcatalog/branches/branch-0.4/CHANGES.txt (original)
+++ incubator/hcatalog/branches/branch-0.4/CHANGES.txt Thu Apr 12 00:53:45 2012
@@ -58,6 +58,8 @@ Release 0.4.0 - Unreleased
   HCAT-240. Changes to HCatOutputFormat to make it use SerDes instead of StorageDriver (toffer)
 
   NEW FEATURES
+  HCAT-342 enable hcat to work with hive bigtop rpm (thejas via gates)
+
   HCAT-287 Add data api to HCatalog (hashutosh)
 
   HCAT-310 Turn current RM implementation into HBase Coprocessor (thw via toffer)

Modified: incubator/hcatalog/branches/branch-0.4/bin/hcat
URL: http://svn.apache.org/viewvc/incubator/hcatalog/branches/branch-0.4/bin/hcat?rev=1325084&r1=1325083&r2=1325084&view=diff
==============================================================================
--- incubator/hcatalog/branches/branch-0.4/bin/hcat (original)
+++ incubator/hcatalog/branches/branch-0.4/bin/hcat Thu Apr 12 00:53:45 2012
@@ -57,6 +57,46 @@ for f in $@; do
      fi
 done
 
+# check for hive in the path
+HIVE_IN_PATH=`which hive 2>/dev/null`
+if [ -f ${HIVE_IN_PATH} ]; then
+  #dir of hive scrip
+  HIVE_DIR=`dirname "$HIVE_IN_PATH"`
+  #one level up for base dir
+  HIVE_DIR=`dirname "$HIVE_DIR"`
+fi
+
+# HIVE_HOME env variable overrides hive in the path
+HIVE_HOME=${HIVE_HOME:-$HIVE_DIR}
+
+if [ "$HIVE_HOME" == "" ]; then
+  echo "Cannot find hive installation: \$HIVE_HOME must be set or hive must be in the path";
+  exit 4;
+fi
+
+if [ "$HIVE_HOME" == '/usr' ] || [ "$HIVE_HOME" == '/usr/' ]; then
+  #this would be a hive rpm install, bigtop rpm  has HIVE_HOME dir
+  #structure in /usr/lib/hive. Use that if the dir structure looks good
+  if [ -d '/usr/lib/hive/conf' ] && [ -d '/usr/lib/hive/lib' ]; then
+    HIVE_HOME='/usr/lib/hive/';
+  fi
+fi
+
+
+
+HIVE_LIB_DIR=${HIVE_HOME}/lib
+if [ ! -d "$HIVE_LIB_DIR" ]; then
+  echo "Cannot find lib dir within HIVE_HOME : $HIVE_LIB_DIR";
+  exit 4;
+fi
+
+HIVE_CONF_DIR=${HIVE_HOME}/conf
+if [ ! -d "$HIVE_CONF_DIR" ]; then
+  echo "Cannot find conf dir within HIVE_HOME : $HIVE_CONF_DIR";
+  exit 4;
+fi
+
+
 # Find our hcatalog jar
 shopt -s extglob
 if (( `ls -1 $HCAT_PREFIX/share/hcatalog/hcatalog-[0-9]*.jar | wc -l` > 1 )) ; then
@@ -65,13 +105,18 @@ if (( `ls -1 $HCAT_PREFIX/share/hcatalog
 fi
 HCAT_JAR=`ls $HCAT_PREFIX/share/hcatalog/hcatalog-[0-9]*.jar`
 
+# Find the storage-handler jars.
+for jar in ${HCAT_PREFIX}/lib/*.jar ; do
+	HADOOP_CLASSPATH=$HADOOP_CLASSPATH:$jar
+done
+
 # Add all of the other jars to our classpath
-for jar in $HCAT_PREFIX/share/hcatalog/lib/*.jar ; do
+for jar in ${HIVE_LIB_DIR}/*.jar ; do
 	HADOOP_CLASSPATH=$HADOOP_CLASSPATH:$jar
 done
 
-# Put our config file in the classpath
-HADOOP_CLASSPATH=${HADOOP_CLASSPATH}:${HCAT_JAR}:${HCAT_CONF_DIR}
+# Put external jars, hcat jar, and config file in the classpath
+HADOOP_CLASSPATH=${HADOOP_CLASSPATH}:${HCAT_CLASSPATH}:${HCAT_JAR}:${HIVE_CONF_DIR}
 
 if [ -n "$HBASE_CONF_DIR" ] && [ -d $HBASE_CONF_DIR ]; then
     HADOOP_CLASSPATH=${HADOOP_CLASSPATH}:${HBASE_CONF_DIR}