(final byte[] key,
final ArrayList<KeyValue> row,
List<Annotation> notes,
final List<HistogramDataPoint> hists)
| 487 | } |
| 488 | |
| 489 | private void processRollupQuery(final byte[] key, |
| 490 | final ArrayList<KeyValue> row, |
| 491 | List<Annotation> notes, |
| 492 | final List<HistogramDataPoint> hists) { |
| 493 | for (KeyValue kv : row) { |
| 494 | mul_get_number_byte_fetched = mul_get_number_byte_fetched + |
| 495 | kv.value().length + kv.key().length; |
| 496 | number_byte_fetched.addAndGet(kv.value().length + kv.key().length); |
| 497 | if (number_byte_fetched.get() > max_bytes) { |
| 498 | handleException( |
| 499 | new QueryException(HttpResponseStatus.REQUEST_ENTITY_TOO_LARGE, |
| 500 | "Sorry, you have attempted to fetch more than our maximum " |
| 501 | + "amount of " + (max_bytes / 1024 / 1024) + "MB from storage. " |
| 502 | + "Please try reducing your time range or adjust the query filters.")); |
| 503 | close(false); |
| 504 | return; |
| 505 | } |
| 506 | final byte[] qual = kv.qualifier(); |
| 507 | |
| 508 | if (qual.length > 0) { |
| 509 | // Todo: Bug! Here we shouldn't use the first byte to check the type |
| 510 | // of this row |
| 511 | // Instead should parse the byte array to find the suffix and |
| 512 | // determine the actual type |
| 513 | if (qual[0] == Annotation.PREFIX()) { |
| 514 | // This could be a row with only an annotation in it |
| 515 | final Annotation note = JSON.parseToObject(kv.value(), Annotation.class); |
| 516 | notes.add(note); |
| 517 | } else if (qual[0] == HistogramDataPoint.PREFIX) { |
| 518 | try { |
| 519 | HistogramDataPoint histogram = Internal.decodeHistogramDataPoint(tsdb, kv); |
| 520 | hists.add(histogram); |
| 521 | } catch (Throwable t) { |
| 522 | LOG.error("Failed to decode histogram data point", t); |
| 523 | } |
| 524 | } else { |
| 525 | if (qual[0] == (byte) rollup_agg_id || |
| 526 | qual[0] == (byte) rollup_count_id || |
| 527 | rollup_query.getRollupAgg() == Aggregators.AVG || |
| 528 | rollup_query.getRollupAgg() == Aggregators.DEV) { |
| 529 | if (Bytes.memcmp(RollupQuery.SUM, qual, 0, RollupQuery.SUM.length) == 0 |
| 530 | || Bytes.memcmp(RollupQuery.COUNT, qual, 0, RollupQuery.COUNT.length) == 0) { |
| 531 | keyValues.add(kv); |
| 532 | } |
| 533 | } else if (Bytes.memcmp(rollup_query.getRollupAggPrefix(), qual, 0, |
| 534 | rollup_query.getRollupAggPrefix().length) == 0) { |
| 535 | keyValues.add(kv); |
| 536 | } |
| 537 | } |
| 538 | } |
| 539 | } // end for |
| 540 | |
| 541 | // histogram row |
| 542 | if (hists.size() > 0) { |
| 543 | histograms.add(new SimpleEntry<byte[], List<HistogramDataPoint>>(key, hists)); |
| 544 | } |
| 545 | } |
| 546 |
no test coverage detected