MCPcopy
hub / github.com/OpenTSDB/opentsdb / AbstractSpanGroup

Class AbstractSpanGroup

src/core/AbstractSpanGroup.java:48–70  ·  view source on GitHub ↗

Groups multiple spans together and offers a dynamic "view" on them. This is used for queries to the TSDB, where we might group multiple Spans that are for the same time series but different tags together. We need to "hide" data points that are outside of the time period of the query and

Source from the content-addressed store, hash-verified

46 * iterator when using the {@link Span.DownsamplingIterator}.
47 */
48abstract class AbstractSpanGroup implements DataPoints {
49 /**
50 * Finds the {@code i}th data point of this group in {@code O(n)}.
51 * Where {@code n} is the number of data points in this group.
52 */
53 protected DataPoint getDataPoint(int i) {
54 if (i < 0) {
55 throw new IndexOutOfBoundsException("negative index: " + i);
56 }
57 final int saved_i = i;
58 final SeekableView it = iterator();
59 DataPoint dp = null;
60 while (it.hasNext() && i >= 0) {
61 dp = it.next();
62 i--;
63 }
64 if (i != -1 || dp == null) {
65 throw new IndexOutOfBoundsException("index " + saved_i
66 + " too large (it's >= " + size() + ") for " + this);
67 }
68 return dp;
69 }
70}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…