You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by ha...@apache.org on 2013/10/09 17:52:29 UTC

svn commit: r1530688 - in /hive/trunk: common/ common/src/java/org/apache/hive/common/ common/src/java/org/apache/hive/common/util/ common/src/scripts/ metastore/src/java/org/apache/hadoop/hive/metastore/

Author: hashutosh
Date: Wed Oct  9 15:52:28 2013
New Revision: 1530688

URL: http://svn.apache.org/r1530688
Log:
HIVE-5484 : TestSchemaTool failures when Hive version has more than 3 revision numbers (Jason Dere via Ashutosh Chauhan)

Modified:
    hive/trunk/common/build.xml
    hive/trunk/common/src/java/org/apache/hive/common/HiveVersionAnnotation.java
    hive/trunk/common/src/java/org/apache/hive/common/util/HiveVersionInfo.java
    hive/trunk/common/src/scripts/saveVersion.sh
    hive/trunk/metastore/src/java/org/apache/hadoop/hive/metastore/MetaStoreSchemaInfo.java

Modified: hive/trunk/common/build.xml
URL: http://svn.apache.org/viewvc/hive/trunk/common/build.xml?rev=1530688&r1=1530687&r2=1530688&view=diff
==============================================================================
--- hive/trunk/common/build.xml (original)
+++ hive/trunk/common/build.xml Wed Oct  9 15:52:28 2013
@@ -30,9 +30,15 @@ to call at top-level: ant deploy-contrib
 
   <target name="compile" depends="init, setup, ivy-retrieve">
     <echo message="Project: ${ant.project.name}"/>
+    <!-- Restrict short version to just major.minor.change numbers -->
+    <propertyregex property="shortversion"
+      input="${version}" regexp="^([0-9]+\.[0-9]+\.[0-9]+)"
+      select="\1" defaultValue="${version}"
+    />
     <exec executable="bash" failonerror="true">
       <arg value="${basedir}/src/scripts/saveVersion.sh"/>
       <arg value="${version}"/>
+      <arg value="${shortversion}"/>
       <arg value="${basedir}/src"/>
     </exec>
     <javac

Modified: hive/trunk/common/src/java/org/apache/hive/common/HiveVersionAnnotation.java
URL: http://svn.apache.org/viewvc/hive/trunk/common/src/java/org/apache/hive/common/HiveVersionAnnotation.java?rev=1530688&r1=1530687&r2=1530688&view=diff
==============================================================================
--- hive/trunk/common/src/java/org/apache/hive/common/HiveVersionAnnotation.java (original)
+++ hive/trunk/common/src/java/org/apache/hive/common/HiveVersionAnnotation.java Wed Oct  9 15:52:28 2013
@@ -41,6 +41,12 @@ public @interface HiveVersionAnnotation 
   String version();
 
   /**
+   * Get the Hive short version containing major/minor/change version numbers
+   * @return the short version string "0.6.3"
+   */
+  String shortVersion();
+
+  /**
    * Get the username that compiled Hive.
    */
   String user();

Modified: hive/trunk/common/src/java/org/apache/hive/common/util/HiveVersionInfo.java
URL: http://svn.apache.org/viewvc/hive/trunk/common/src/java/org/apache/hive/common/util/HiveVersionInfo.java?rev=1530688&r1=1530687&r2=1530688&view=diff
==============================================================================
--- hive/trunk/common/src/java/org/apache/hive/common/util/HiveVersionInfo.java (original)
+++ hive/trunk/common/src/java/org/apache/hive/common/util/HiveVersionInfo.java Wed Oct  9 15:52:28 2013
@@ -58,6 +58,14 @@ public class HiveVersionInfo {
   }
 
   /**
+   * Get the Hive short version, with major/minor/change version numbers.
+   * @return short version string, eg. "0.6.3"
+   */
+  public static String getShortVersion() {
+    return version != null ? version.shortVersion() : "Unknown";
+  }
+
+  /**
    * Get the subversion revision number for the root directory
    * @return the revision number, eg. "451451"
    */

Modified: hive/trunk/common/src/scripts/saveVersion.sh
URL: http://svn.apache.org/viewvc/hive/trunk/common/src/scripts/saveVersion.sh?rev=1530688&r1=1530687&r2=1530688&view=diff
==============================================================================
--- hive/trunk/common/src/scripts/saveVersion.sh (original)
+++ hive/trunk/common/src/scripts/saveVersion.sh Wed Oct  9 15:52:28 2013
@@ -22,10 +22,11 @@ unset LANG
 unset LC_CTYPE
 unset LC_TIME
 version=$1
-src_dir=$2
-revision=$3
-branch=$4
-url=$5
+shortversion=$2
+src_dir=$3
+revision=$4
+branch=$5
+url=$6
 user=`whoami`
 date=`date`
 dir=`pwd`
@@ -68,14 +69,16 @@ url=`echo $url | tr -d '\r'`
 srcChecksum=`echo $srcChecksum | tr -d '\r'`
 
 cat << EOF | \
-  sed -e "s/VERSION/$version/" -e "s/USER/$user/" -e "s/DATE/$date/" \
+  sed -e "s/VERSION/$version/" -e "s/SHORTVERSION/$shortversion/" \
+      -e "s/USER/$user/" -e "s/DATE/$date/" \
       -e "s|URL|$url|" -e "s/REV/$revision/" \
       -e "s|BRANCH|$branch|" -e "s/SRCCHECKSUM/$srcChecksum/" \
       > $src_dir/gen/org/apache/hive/common/package-info.java
 /*
  * Generated by saveVersion.sh
  */
-@HiveVersionAnnotation(version="VERSION", revision="REV", branch="BRANCH",
+@HiveVersionAnnotation(version="VERSION", shortVersion="SHORTVERSION",
+                         revision="REV", branch="BRANCH",
                          user="USER", date="DATE", url="URL",
                          srcChecksum="SRCCHECKSUM")
 package org.apache.hive.common;

Modified: hive/trunk/metastore/src/java/org/apache/hadoop/hive/metastore/MetaStoreSchemaInfo.java
URL: http://svn.apache.org/viewvc/hive/trunk/metastore/src/java/org/apache/hadoop/hive/metastore/MetaStoreSchemaInfo.java?rev=1530688&r1=1530687&r2=1530688&view=diff
==============================================================================
--- hive/trunk/metastore/src/java/org/apache/hadoop/hive/metastore/MetaStoreSchemaInfo.java (original)
+++ hive/trunk/metastore/src/java/org/apache/hadoop/hive/metastore/MetaStoreSchemaInfo.java Wed Oct  9 15:52:28 2013
@@ -130,9 +130,9 @@ public class MetaStoreSchemaInfo {
     return UPGRADE_FILE_PREFIX +  fileVersion + "." + dbType + SQL_FILE_EXTENSION;
   }
 
-  // Current hive version, remove the 'SNAPSHOT' part if needed
+  // Current hive version, in majorVersion.minorVersion.changeVersion format
   public static String getHiveSchemaVersion() {
-    return HiveVersionInfo.getVersion().replace("-SNAPSHOT", "");
+    return HiveVersionInfo.getShortVersion();
   }
 
 }