if (result != null) {
return result;
}
// If either no row has been scanned or already exhausted all columns from previous scan, find the next row.
Row rowResult;
while ((rowResult = scanner.next()) != null) {
rowScanned++;
byte[] rowKey = rowResult.getRow();
// Decode context and metric from key
int offset = 0;
context = entityCodec.decode(MetricsEntityType.CONTEXT, rowKey, offset);
// Always have a "." suffix for unique matching
if (contextPrefix != null && !(context + ".").startsWith(contextPrefix)) {
continue;
}
offset += entityCodec.getEncodedSize(MetricsEntityType.CONTEXT);
metric = entityCodec.decode(MetricsEntityType.METRIC, rowKey, offset);
// Always have a "." suffix for unique matching
if (metricPrefix != null && !(metric + ".").startsWith(metricPrefix)) {
continue;
}
offset += entityCodec.getEncodedSize(MetricsEntityType.METRIC);
rid = entityCodec.decode(MetricsEntityType.RUN, rowKey, offset);
if (runId != null && !runId.equals(rid)) {
continue;
}
currentTag = rowResult.getColumns().entrySet().iterator();
result = findNextResult();
if (result != null) {
return result;
}
}