You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by na...@apache.org on 2009/11/19 02:54:46 UTC

svn commit: r882026 - in /hadoop/hive/trunk: CHANGES.txt bin/ext/hiveserver.sh

Author: namit
Date: Thu Nov 19 01:54:44 2009
New Revision: 882026

URL: http://svn.apache.org/viewvc?rev=882026&view=rev
Log:
HIVE-941 hiveserver.sh doesn't work with Hadoop 0.20.0 or higher
(Ning Zhang via namit)


Modified:
    hadoop/hive/trunk/CHANGES.txt
    hadoop/hive/trunk/bin/ext/hiveserver.sh

Modified: hadoop/hive/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/CHANGES.txt?rev=882026&r1=882025&r2=882026&view=diff
==============================================================================
--- hadoop/hive/trunk/CHANGES.txt (original)
+++ hadoop/hive/trunk/CHANGES.txt Thu Nov 19 01:54:44 2009
@@ -269,6 +269,9 @@
 
     HIVE-940 restrict creation of partitions with empty keys (Prasad Chakka via namit)
 
+    HIVE-941 hiveserver.sh doesn't work with Hadoop 0.20.0 or higher
+    (Ning Zhang via namit)
+
 Release 0.4.0 -  Unreleased
 
   INCOMPATIBLE CHANGES

Modified: hadoop/hive/trunk/bin/ext/hiveserver.sh
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/bin/ext/hiveserver.sh?rev=882026&r1=882025&r2=882026&view=diff
==============================================================================
--- hadoop/hive/trunk/bin/ext/hiveserver.sh (original)
+++ hadoop/hive/trunk/bin/ext/hiveserver.sh Thu Nov 19 01:54:44 2009
@@ -8,10 +8,30 @@
     HIVE_LIB=`cygpath -w "$HIVE_LIB"`
   fi
   JAR=${HIVE_LIB}/hive_service.jar
-  if [ "$HIVE_PORT" != "" ]; then
-    HIVE_OPTS=$HIVE_PORT
+
+  version=$($HADOOP version | awk '{if (NR == 1) {print $2;}}');
+
+  # Save the regex to a var to workaround quoting incompatabilities
+  # between Bash 3.1 and 3.2
+  version_re="^([[:digit:]]+)\.([[:digit:]]+)(\.([[:digit:]]+))?.*$"
+
+  if [[ "$version" =~ $version_re ]]; then
+      major_ver=${BASH_REMATCH[1]}
+      minor_ver=${BASH_REMATCH[2]}
+      patch_ver=${BASH_REMATCH[4]}
+  else
+      echo "Unable to determine Hadoop version information."
+      echo "'hadoop version' returned:"
+      echo `$HADOOP version`
+      exit 6
+  fi
+
+  if [ $minor_ver -lt 20 ]; then
+    exec $HADOOP jar $AUX_JARS_CMD_LINE $JAR $CLASS $HIVE_PORT "$@"
+  else 
+    # hadoop 20 or newer - skip the aux_jars option and hiveconf
+    exec $HADOOP jar $JAR $CLASS $HIVE_PORT "$@"
   fi
-  exec $HADOOP jar $AUX_JARS_CMD_LINE $JAR $CLASS $HIVE_OPTS "$@"
 }
 
 hiveserver_help() {