private static long findMetric(OperatorProfile operatorProfile, final int id) { return FluentIterable.from(operatorProfile.getMetricList()).firstMatch(new Predicate<MetricValue>() { @Override public boolean apply(@Nullable MetricValue input) { return input.getMetricId() == id; } }).get().getLongValue(); }
private boolean madeProgress(final OperatorProfile prev, final OperatorProfile cur) { return prev.getInputProfileCount() != cur.getInputProfileCount() || !prev.getInputProfileList().equals(cur.getInputProfileList()) || prev.getMetricCount() != cur.getMetricCount() || !prev.getMetricList().equals(cur.getMetricList()); }
final boolean toSkip = isHashAgg && renderingOldProfiles(op); final Number[] values = new Number[metricIds.length]; for (final MetricValue metric : op.getMetricList()) { int metricId = metric.getMetricId(); if (toSkip) {
public void writeTo(io.protostuff.Output output, com.dremio.exec.proto.UserBitShared.OperatorProfile message) throws java.io.IOException { for(com.dremio.exec.proto.UserBitShared.StreamProfile inputProfile : message.getInputProfileList()) output.writeObject(1, inputProfile, com.dremio.exec.proto.SchemaUserBitShared.StreamProfile.WRITE, true); if(message.hasOperatorId()) output.writeInt32(3, message.getOperatorId(), false); if(message.hasOperatorType()) output.writeInt32(4, message.getOperatorType(), false); if(message.hasSetupNanos()) output.writeInt64(5, message.getSetupNanos(), false); if(message.hasProcessNanos()) output.writeInt64(6, message.getProcessNanos(), false); if(message.hasPeakLocalMemoryAllocated()) output.writeInt64(7, message.getPeakLocalMemoryAllocated(), false); for(com.dremio.exec.proto.UserBitShared.MetricValue metric : message.getMetricList()) output.writeObject(8, metric, com.dremio.exec.proto.SchemaUserBitShared.MetricValue.WRITE, true); if(message.hasWaitNanos()) output.writeInt64(9, message.getWaitNanos(), false); } public boolean isInitialized(com.dremio.exec.proto.UserBitShared.OperatorProfile message)
private boolean renderingOldProfiles(OperatorProfile op) { final List<MetricValue> metricValues = op.getMetricList(); for (MetricValue metric : metricValues) { final int metricId = metric.getMetricId(); if (metricId == HashAggStats.SKIP_METRIC_START) { /* if the ordinal (metric id) to skip is indeed present * in the serialized profile that we are trying to render * then we are definitely working with new profiles */ return false; } } return true; } }
private void setSortSpillInfo(CoreOperatorType operatorType, OperatorProfile operatorProfile) { initSpillJobDetails(); final int operatorNumber = operatorType.getNumber(); Preconditions.checkState(operatorNumber == CoreOperatorType.EXTERNAL_SORT_VALUE); final List<UserBitShared.MetricValue> metricValues = operatorProfile.getMetricList(); for (UserBitShared.MetricValue metricValue : metricValues) { final int metricId = metricValue.getMetricId(); if (metricId == ExternalSortOperator.Metric.TOTAL_SPILLED_DATA_SIZE.ordinal() && metricValue.hasLongValue()) { spillJobDetails.setTotalBytesSpilledBySort(spillJobDetails.getTotalBytesSpilledBySort() + metricValue.getLongValue()); } } }
private void setAggSpillInfo(CoreOperatorType operatorType, OperatorProfile operatorProfile) { initSpillJobDetails(); final int operatorNumber = operatorType.getNumber(); Preconditions.checkState(operatorNumber == CoreOperatorType.HASH_AGGREGATE_VALUE); final List<UserBitShared.MetricValue> metricValues = operatorProfile.getMetricList(); for (UserBitShared.MetricValue metricValue : metricValues) { final int metricId = metricValue.getMetricId(); if (metricId == HashAggStats.Metric.TOTAL_SPILLED_DATA_SIZE.ordinal() && metricValue.hasLongValue()) { spillJobDetails.setTotalBytesSpilledByHashAgg(spillJobDetails.getTotalBytesSpilledByHashAgg() + metricValue.getLongValue()); } } }