tez-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zhiyu...@apache.org
Subject [4/8] tez git commit: TEZ-3869. Analyzer: Fix VertexInfo::getLastTaskToFinish comparison (rbalamohan)
Date Wed, 13 Dec 2017 00:01:46 GMT
TEZ-3869. Analyzer: Fix VertexInfo::getLastTaskToFinish comparison (rbalamohan)


Project: http://git-wip-us.apache.org/repos/asf/tez/repo
Commit: http://git-wip-us.apache.org/repos/asf/tez/commit/cfede26b
Tree: http://git-wip-us.apache.org/repos/asf/tez/tree/cfede26b
Diff: http://git-wip-us.apache.org/repos/asf/tez/diff/cfede26b

Branch: refs/heads/branch-0.9.1
Commit: cfede26b054a8a0243e969ee0e62b25a6f542f10
Parents: 07c4c3a
Author: Rajesh Balamohan <rbalamohan@apache.org>
Authored: Mon Dec 4 03:34:32 2017 +0530
Committer: Rajesh Balamohan <rbalamohan@apache.org>
Committed: Mon Dec 4 03:34:32 2017 +0530

----------------------------------------------------------------------
 .../tez/history/parser/datamodel/VertexInfo.java   | 17 +++++------------
 1 file changed, 5 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tez/blob/cfede26b/tez-plugins/tez-history-parser/src/main/java/org/apache/tez/history/parser/datamodel/VertexInfo.java
----------------------------------------------------------------------
diff --git a/tez-plugins/tez-history-parser/src/main/java/org/apache/tez/history/parser/datamodel/VertexInfo.java
b/tez-plugins/tez-history-parser/src/main/java/org/apache/tez/history/parser/datamodel/VertexInfo.java
index 0f6831b..038a874 100644
--- a/tez-plugins/tez-history-parser/src/main/java/org/apache/tez/history/parser/datamodel/VertexInfo.java
+++ b/tez-plugins/tez-history-parser/src/main/java/org/apache/tez/history/parser/datamodel/VertexInfo.java
@@ -521,9 +521,7 @@ public class VertexInfo extends BaseInfo {
     }
     Collections.sort(taskInfoList, new Comparator<TaskInfo>() {
       @Override public int compare(TaskInfo o1, TaskInfo o2) {
-        return (o1.getStartTimeInterval() < o2.getStartTimeInterval()) ? -1 :
-            ((o1.getStartTimeInterval() == o2.getStartTimeInterval()) ?
-                0 : 1);
+        return Long.compare(o1.getStartTimeInterval(), o2.getStartTimeInterval());
       }
     });
     return taskInfoList.get(0);
@@ -541,9 +539,7 @@ public class VertexInfo extends BaseInfo {
     }
     Collections.sort(taskInfoList, new Comparator<TaskInfo>() {
       @Override public int compare(TaskInfo o1, TaskInfo o2) {
-        return (o1.getFinishTimeInterval() > o2.getFinishTimeInterval()) ? -1 :
-            ((o1.getStartTimeInterval() == o2.getStartTimeInterval()) ?
-                0 : 1);
+        return -1 * Long.compare(o1.getFinishTimeInterval(), o2.getFinishTimeInterval());
       }
     });
     return taskInfoList.get(0);
@@ -589,8 +585,7 @@ public class VertexInfo extends BaseInfo {
   private Ordering<TaskInfo> orderingOnTimeTaken() {
     return Ordering.from(new Comparator<TaskInfo>() {
       @Override public int compare(TaskInfo o1, TaskInfo o2) {
-        return (o1.getTimeTaken() < o2.getTimeTaken()) ? -1 :
-            ((o1.getTimeTaken() == o2.getTimeTaken()) ? 0 : 1);
+        return Long.compare(o1.getTimeTaken(), o2.getTimeTaken());
       }
     });
   }
@@ -598,8 +593,7 @@ public class VertexInfo extends BaseInfo {
   private Ordering<TaskInfo> orderingOnStartTime() {
     return Ordering.from(new Comparator<TaskInfo>() {
       @Override public int compare(TaskInfo o1, TaskInfo o2) {
-        return (o1.getStartTimeInterval() < o2.getStartTimeInterval()) ? -1 :
-            ((o1.getStartTimeInterval() == o2.getStartTimeInterval()) ? 0 : 1);
+        return Long.compare(o1.getStartTimeInterval(), o2.getStartTimeInterval());
       }
     });
   }
@@ -607,8 +601,7 @@ public class VertexInfo extends BaseInfo {
   private Ordering<TaskAttemptInfo> orderingOnAttemptStartTime() {
     return Ordering.from(new Comparator<TaskAttemptInfo>() {
       @Override public int compare(TaskAttemptInfo o1, TaskAttemptInfo o2) {
-        return (o1.getStartTimeInterval() < o2.getStartTimeInterval()) ? -1 :
-            ((o1.getStartTimeInterval() == o2.getStartTimeInterval()) ? 0 : 1);
+        return Long.compare(o1.getStartTimeInterval(), o2.getStartTimeInterval());
       }
     });
   }


Mime
View raw message