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

Class ExpressionDataPoint

src/query/expression/ExpressionDataPoint.java:33–258  ·  view source on GitHub ↗

Contains the information for a series that has been processed through an expression iterator. Each time a metric data point series set is added we add the metric and compute the tag sets. As the iterator progresses, it will call into the #reset methods. @since 2.3

Source from the content-addressed store, hash-verified

31 * @since 2.3
32 */
33public class ExpressionDataPoint implements DataPoint {
34
35 /** A list of metric UIDs wrapped up into this expression result */
36 private final ByteSet metric_uids;
37
38 /** The list of tag key/value pairs common to all series in this expression */
39 private final ByteMap<byte[]> tags;
40
41 /** The list of aggregated tag keys common to all series in this expression */
42 private final ByteSet aggregated_tags;
43
44 /** The list of TSUIDs from all series in this expression */
45 private final Set<String> tsuids;
46
47 /** The size of the aggregated results.
48 * TODO - this is simply the size of the first series added. We need a way
49 * to compute this properly.
50 */
51 private long size;
52
53 /** The total number of raw data points in all series */
54 private long raw_size;
55
56 /** The data point overwritten each time through the iterator */
57 private final MutableDataPoint dp;
58
59 /** An index in the original {@link TimeSyncedIterator} iterator array */
60 private int index;
61
62 /**
63 * Default ctor that simply sets up new objects for all internal fields.
64 * TODO - lazily initialize the field to avoid unused objects
65 */
66 public ExpressionDataPoint() {
67 metric_uids = new ByteSet();
68 tags = new ByteMap<byte[]>();
69 aggregated_tags = new ByteSet();
70 tsuids = new HashSet<String>();
71 dp = new MutableDataPoint();
72 }
73
74 /**
75 * Ctor that sets up the meta data maps and initializes an empty dp
76 * @param dps The data point to pull meta from
77 */
78 @SuppressWarnings("unchecked")
79 public ExpressionDataPoint(final DataPoints dps) {
80 metric_uids = new ByteSet();
81 metric_uids.add(dps.metricUID());
82 tags = dps.getTagUids() != null ?
83 (ByteMap<byte[]>) dps.getTagUids().clone() : new ByteMap<byte[]>();
84 aggregated_tags = new ByteSet();
85 if (dps.getAggregatedTagUids() != null) {
86 for (final byte[] tagk : dps.getAggregatedTagUids()) {
87 aggregated_tags.add(tagk);
88 }
89 }
90 tsuids = new HashSet<String>(dps.getTSUIDs());

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…