[ https://issues.apache.org/jira/browse/DRILL-3340?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14969592#comment-14969592 ]
ASF GitHub Bot commented on DRILL-3340: --------------------------------------- Github user adeneche commented on a diff in the pull request: https://github.com/apache/drill/pull/216#discussion_r42786354 --- Diff: exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/profile/OperatorWrapper.java --- @@ -130,4 +136,32 @@ public void addSummary(TableBuilder tb) { tb.appendBytes(Math.round(memSum / size), null); tb.appendBytes(peakMem.getLeft().getPeakLocalMemoryAllocated(), null); } + + public String getMetricsTable() { + if (!OperatorMetricRegistry.contains(operatorType.getNumber())) { + return ""; + } + final ArrayList<String> metricNames = Lists.newArrayList("Minor Fragment"); + for (final MetricValue metric : firstProfile.getMetricList()) { + metricNames.add(OperatorMetricRegistry.getMetricName(operatorType.getNumber(), metric.getMetricId())); + } + + final String[] metricsTableColumnNames = new String[metricNames.size()]; + final TableBuilder builder = new TableBuilder(metricNames.toArray(metricsTableColumnNames)); + for (final ImmutablePair<OperatorProfile, Integer> ip : ops) { + final OperatorProfile op = ip.getLeft(); + + builder.appendCell( + new OperatorPathBuilder() + .setMajor(major) + .setMinor(ip.getRight()) + .setOperator(op) + .build(), + null); + for (final MetricValue metric : op.getMetricList()) { + builder.appendInteger(metric.getLongValue(), null); --- End diff -- the code builds the table header from the first profile's metric list, then assumes all minor fragments will have the metrics in the same order of the first profile. Can you confirm that this assumption is always true ? > Add named metrics and named operators in OperatorProfile > -------------------------------------------------------- > > Key: DRILL-3340 > URL: https://issues.apache.org/jira/browse/DRILL-3340 > Project: Apache Drill > Issue Type: Improvement > Reporter: Sudheesh Katkam > Assignee: Sudheesh Katkam > Priority: Minor > Fix For: 1.3.0 > > Attachments: DRILL-3340.1.patch.txt, DRILL-3340.2.patch.txt, > DRILL-3340.3.patch.txt > > > + Useful when reading JSON query profile. > + Rename FragmentStats#getOperatorStats to FragmentStats#newOperatorStats -- This message was sent by Atlassian JIRA (v6.3.4#6332)