pig-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zjf...@apache.org
Subject svn commit: r1766466 - in /pig/branches/branch-0.16: ./ src/org/apache/pig/tools/pigstats/ src/org/apache/pig/tools/pigstats/mapreduce/ src/org/apache/pig/tools/pigstats/tez/
Date Tue, 25 Oct 2016 03:18:54 GMT
Author: zjffdu
Date: Tue Oct 25 03:18:53 2016
New Revision: 1766466

URL: http://svn.apache.org/viewvc?rev=1766466&view=rev
Log:
PIG-5037: Add api getDisplayString to PigStats (zjffdu)

Modified:
    pig/branches/branch-0.16/CHANGES.txt
    pig/branches/branch-0.16/src/org/apache/pig/tools/pigstats/EmbeddedPigStats.java
    pig/branches/branch-0.16/src/org/apache/pig/tools/pigstats/EmptyPigStats.java
    pig/branches/branch-0.16/src/org/apache/pig/tools/pigstats/PigStats.java
    pig/branches/branch-0.16/src/org/apache/pig/tools/pigstats/mapreduce/SimplePigStats.java
    pig/branches/branch-0.16/src/org/apache/pig/tools/pigstats/tez/TezPigScriptStats.java

Modified: pig/branches/branch-0.16/CHANGES.txt
URL: http://svn.apache.org/viewvc/pig/branches/branch-0.16/CHANGES.txt?rev=1766466&r1=1766465&r2=1766466&view=diff
==============================================================================
--- pig/branches/branch-0.16/CHANGES.txt (original)
+++ pig/branches/branch-0.16/CHANGES.txt Tue Oct 25 03:18:53 2016
@@ -24,6 +24,8 @@ INCOMPATIBLE CHANGES
 
 IMPROVEMENTS
 
+PIG-5037: Add api getDisplayString to PigStats (zjffdu)
+
 PIG-4945: Update document for conflicting macro params (knoguchi via daijy)
 
 OPTIMIZATIONS

Modified: pig/branches/branch-0.16/src/org/apache/pig/tools/pigstats/EmbeddedPigStats.java
URL: http://svn.apache.org/viewvc/pig/branches/branch-0.16/src/org/apache/pig/tools/pigstats/EmbeddedPigStats.java?rev=1766466&r1=1766465&r2=1766466&view=diff
==============================================================================
--- pig/branches/branch-0.16/src/org/apache/pig/tools/pigstats/EmbeddedPigStats.java (original)
+++ pig/branches/branch-0.16/src/org/apache/pig/tools/pigstats/EmbeddedPigStats.java Tue Oct
25 03:18:53 2016
@@ -147,6 +147,11 @@ final class EmbeddedPigStats extends Pig
     }
 
     @Override
+    public String getDisplayString() {
+        return null;
+    }
+
+    @Override
     public long getProactiveSpillCountObjects() {
         throw new UnsupportedOperationException();
     }

Modified: pig/branches/branch-0.16/src/org/apache/pig/tools/pigstats/EmptyPigStats.java
URL: http://svn.apache.org/viewvc/pig/branches/branch-0.16/src/org/apache/pig/tools/pigstats/EmptyPigStats.java?rev=1766466&r1=1766465&r2=1766466&view=diff
==============================================================================
--- pig/branches/branch-0.16/src/org/apache/pig/tools/pigstats/EmptyPigStats.java (original)
+++ pig/branches/branch-0.16/src/org/apache/pig/tools/pigstats/EmptyPigStats.java Tue Oct
25 03:18:53 2016
@@ -87,6 +87,11 @@ public class EmptyPigStats extends PigSt
     }
 
     @Override
+    public String getDisplayString() {
+        return null;
+    }
+
+    @Override
     public JobGraph getJobGraph() {
        return emptyJobPlan;
     }

Modified: pig/branches/branch-0.16/src/org/apache/pig/tools/pigstats/PigStats.java
URL: http://svn.apache.org/viewvc/pig/branches/branch-0.16/src/org/apache/pig/tools/pigstats/PigStats.java?rev=1766466&r1=1766465&r2=1766466&view=diff
==============================================================================
--- pig/branches/branch-0.16/src/org/apache/pig/tools/pigstats/PigStats.java (original)
+++ pig/branches/branch-0.16/src/org/apache/pig/tools/pigstats/PigStats.java Tue Oct 25 03:18:53
2016
@@ -134,6 +134,11 @@ public abstract class PigStats {
     }
 
     /**
+     * Returns the display message in pig grunt
+     */
+    public abstract String getDisplayString();
+
+    /**
      * Returns the DAG of jobs spawned by the script
      */
     public JobGraph getJobGraph() {

Modified: pig/branches/branch-0.16/src/org/apache/pig/tools/pigstats/mapreduce/SimplePigStats.java
URL: http://svn.apache.org/viewvc/pig/branches/branch-0.16/src/org/apache/pig/tools/pigstats/mapreduce/SimplePigStats.java?rev=1766466&r1=1766465&r2=1766466&view=diff
==============================================================================
--- pig/branches/branch-0.16/src/org/apache/pig/tools/pigstats/mapreduce/SimplePigStats.java
(original)
+++ pig/branches/branch-0.16/src/org/apache/pig/tools/pigstats/mapreduce/SimplePigStats.java
Tue Oct 25 03:18:53 2016
@@ -207,13 +207,18 @@ public final class SimplePigStats extend
     }
 
     void display() {
+        LOG.info(getDisplayString());
+    }
+
+    @Override
+    public String getDisplayString() {
         if (returnCode == ReturnCode.UNKNOWN) {
             LOG.warn("unknown return code, can't display the results");
-            return;
+            return "";
         }
         if (pigContext == null) {
             LOG.warn("unknown exec type, don't display the results");
-            return;
+            return "";
         }
 
         SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT);
@@ -276,7 +281,7 @@ public final class SimplePigStats extend
 
         sb.append("\nJob DAG:\n").append(jobPlan.toString());
 
-        LOG.info("Script Statistics: \n" + sb.toString());
+        return "Script Statistics: \n" + sb.toString();
     }
 
     void mapMROperToJob(MapReduceOper mro, Job job) {

Modified: pig/branches/branch-0.16/src/org/apache/pig/tools/pigstats/tez/TezPigScriptStats.java
URL: http://svn.apache.org/viewvc/pig/branches/branch-0.16/src/org/apache/pig/tools/pigstats/tez/TezPigScriptStats.java?rev=1766466&r1=1766465&r2=1766466&view=diff
==============================================================================
--- pig/branches/branch-0.16/src/org/apache/pig/tools/pigstats/tez/TezPigScriptStats.java
(original)
+++ pig/branches/branch-0.16/src/org/apache/pig/tools/pigstats/tez/TezPigScriptStats.java
Tue Oct 25 03:18:53 2016
@@ -117,6 +117,11 @@ public class TezPigScriptStats extends P
     }
 
     private void display() {
+        LOG.info(getDisplayString());
+    }
+
+    @Override
+    public String getDisplayString() {
         SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT);
         StringBuilder sb = new StringBuilder();
         sb.append("\n");
@@ -170,7 +175,7 @@ public class TezPigScriptStats extends P
         for (OutputStats os : getOutputStats()) {
             sb.append(os.getDisplayString().trim()).append("\n");
         }
-        LOG.info("Script Statistics:\n" + sb.toString());
+        return "Script Statistics:\n" + sb.toString();
     }
 
     /**



Mime
View raw message