Author: khorgath
Date: Wed Mar 26 02:17:36 2014
New Revision: 1581630

URL: http://svn.apache.org/r1581630
Log:
HIVE-6521 : WebHCat cannot fetch correct percentComplete for Hive jobs (Deepesh 
Khandelwal via Sushanth Sowmyan)

Modified:
    hive/trunk/hcatalog/src/test/e2e/templeton/tests/jobsubmission.conf
    
hive/trunk/hcatalog/webhcat/svr/src/main/java/org/apache/hive/hcatalog/templeton/tool/TempletonUtils.java

Modified: hive/trunk/hcatalog/src/test/e2e/templeton/tests/jobsubmission.conf
URL: 
http://svn.apache.org/viewvc/hive/trunk/hcatalog/src/test/e2e/templeton/tests/jobsubmission.conf?rev=1581630&r1=1581629&r2=1581630&view=diff
==============================================================================
--- hive/trunk/hcatalog/src/test/e2e/templeton/tests/jobsubmission.conf 
(original)
+++ hive/trunk/hcatalog/src/test/e2e/templeton/tests/jobsubmission.conf Wed Mar 
26 02:17:36 2014
@@ -384,7 +384,7 @@ $cfg = 
      'num' => 7,
      'method' => 'POST',
      'url' => ':TEMPLETON_URL:/templeton/v1/hive',     
-     'post_options' => ['user.name=:UNAME:','execute=select a,b from mynums', 
],
+     'post_options' => ['user.name=:UNAME:','execute=select count(*) from 
mynums', ],
      'json_field_substr_match' => { 'id' => '\d+'},
                                 #results
      'status_code' => 200,

Modified: 
hive/trunk/hcatalog/webhcat/svr/src/main/java/org/apache/hive/hcatalog/templeton/tool/TempletonUtils.java
URL: 
http://svn.apache.org/viewvc/hive/trunk/hcatalog/webhcat/svr/src/main/java/org/apache/hive/hcatalog/templeton/tool/TempletonUtils.java?rev=1581630&r1=1581629&r2=1581630&view=diff
==============================================================================
--- 
hive/trunk/hcatalog/webhcat/svr/src/main/java/org/apache/hive/hcatalog/templeton/tool/TempletonUtils.java
 (original)
+++ 
hive/trunk/hcatalog/webhcat/svr/src/main/java/org/apache/hive/hcatalog/templeton/tool/TempletonUtils.java
 Wed Mar 26 02:17:36 2014
@@ -89,7 +89,7 @@ public class TempletonUtils {
   public static final Pattern JAR_COMPLETE = Pattern.compile(" map 
\\d+%\\s+reduce \\d+%$");
   public static final Pattern PIG_COMPLETE = Pattern.compile(" \\d+% 
complete$");
   //looking for map = 100%,  reduce = 100%
-  public static final Pattern HIVE_COMPLETE = Pattern.compile(" map = 
\\d+%,\\s+reduce = \\d+%$");
+  public static final Pattern HIVE_COMPLETE = Pattern.compile(" map = 
(\\d+%),\\s+reduce = (\\d+%).*$");
 
   /**
    * Extract the percent complete line from Pig or Jar jobs.
@@ -105,15 +105,7 @@ public class TempletonUtils {
     
     Matcher hive = HIVE_COMPLETE.matcher(line);
     if(hive.find()) {
-      StringBuilder sb = new StringBuilder(hive.group().trim());
-      String[] toRemove = {"= ", ", "};
-      for(String pattern : toRemove) {
-        int pos;
-        while((pos = sb.indexOf(pattern)) >= 0) {
-          sb.delete(pos, pos + pattern.length());
-        }
-      }
-      return sb.toString();//normalized to look like JAR_COMPLETE
+      return "map " + hive.group(1) + " reduce " + hive.group(2);
     }
     return null;
   }


Reply via email to