drill-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j..@apache.org
Subject [3/4] drill git commit: DRILL-5242: The UI breaks when trying to render profiles having unknown metrics
Date Tue, 21 Feb 2017 15:33:33 GMT
DRILL-5242: The UI breaks when trying to render profiles having unknown metrics

Skip any metrics whose metric ID is unknown, This prevents any ArrayIndexOutOfBoundsException
from being thrown and breaking the UI rendering.


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

Branch: refs/heads/master
Commit: 0b8ef9e71f71f41cdc2c6a07d01361ee45199516
Parents: a05d700
Author: Kunal Khatua <kkhatua@users.noreply.github.com>
Authored: Fri Feb 3 17:29:47 2017 -0800
Committer: Jinfeng Ni <jni@apache.org>
Committed: Tue Feb 21 00:48:22 2017 -0800

----------------------------------------------------------------------
 .../exec/server/rest/profile/OperatorWrapper.java  | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/drill/blob/0b8ef9e7/exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/profile/OperatorWrapper.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/profile/OperatorWrapper.java
b/exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/profile/OperatorWrapper.java
index 1926655..5d18911 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/profile/OperatorWrapper.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/profile/OperatorWrapper.java
@@ -19,6 +19,8 @@ package org.apache.drill.exec.server.rest.profile;
 
 import java.util.Collections;
 import java.util.List;
+import java.util.Set;
+import java.util.TreeSet;
 
 import com.google.common.base.Preconditions;
 import org.apache.commons.lang3.tuple.ImmutablePair;
@@ -161,11 +163,18 @@ public class OperatorWrapper {
           null);
 
       final Number[] values = new Number[metricNames.length];
+      //Track new/Unknown Metrics
+      final Set<Integer> unknownMetrics = new TreeSet<Integer>();
       for (final MetricValue metric : op.getMetricList()) {
-        if (metric.hasLongValue()) {
-          values[metric.getMetricId()] = metric.getLongValue();
-        } else if (metric.hasDoubleValue()) {
-          values[metric.getMetricId()] = metric.getDoubleValue();
+        if (metric.getMetricId() < metricNames.length) {
+          if (metric.hasLongValue()) {
+            values[metric.getMetricId()] = metric.getLongValue();
+          } else if (metric.hasDoubleValue()) {
+            values[metric.getMetricId()] = metric.getDoubleValue();
+          }
+        } else {
+          //Tracking unknown metric IDs
+          unknownMetrics.add(metric.getMetricId());
         }
       }
       for (final Number value : values) {


Mime
View raw message