[ 
https://issues.apache.org/jira/browse/DRILL-6696?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16583856#comment-16583856
 ] 

ASF GitHub Bot commented on DRILL-6696:
---------------------------------------

arina-ielchiieva commented on a change in pull request #1436: DRILL-6696: 
Improving of operators metrics registry
URL: https://github.com/apache/drill/pull/1436#discussion_r210896426
 
 

 ##########
 File path: 
exec/java-exec/src/main/java/org/apache/drill/exec/ops/OperatorMetricRegistry.java
 ##########
 @@ -61,14 +66,11 @@
 
   private static void register(final int operatorType, final Class<? extends 
MetricDef> metricDef) {
     // Currently registers a metric def that has enum constants
-    final MetricDef[] enumConstants = metricDef.getEnumConstants();
-    if (enumConstants != null) {
-      final String[] names = new String[enumConstants.length];
-      for (int i = 0; i < enumConstants.length; i++) {
-        names[i] = enumConstants[i].name();
-      }
-      OPERATOR_METRICS[operatorType] = names;
-    }
+    String[] names = Arrays.stream(metricDef.getEnumConstants())
 
 Review comment:
   Do you know the case when enum constants are null?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


> Improving of operators metrics registry
> ---------------------------------------
>
>                 Key: DRILL-6696
>                 URL: https://issues.apache.org/jira/browse/DRILL-6696
>             Project: Apache Drill
>          Issue Type: Improvement
>    Affects Versions: 1.14.0
>            Reporter: Vitalii Diravka
>            Assignee: Vitalii Diravka
>            Priority: Minor
>
> There is an issue in _{{OperatorMetricRegistry}}_, OPERATOR_METRICS 
> two-dimensional array doesn't check the index of element. If operator type 
> value isn't a number in order - _{{ArrayIndexOutOfBoundsException}}_ will 
> happen.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to