Default ctor @param id The variable ID for this iterator @param results Upstream iterators @param union_on_query_tagks Whether or not to flatten and join on only the tags from the query or those returned in the results. @param include_agg_tags Whether or not to include the flattened aggregated tag k
(final String id, final Map<String, ITimeSyncedIterator> results,
final boolean union_on_query_tagks, final boolean include_agg_tags)
| 88 | * tag keys in the join. |
| 89 | */ |
| 90 | public UnionIterator(final String id, final Map<String, ITimeSyncedIterator> results, |
| 91 | final boolean union_on_query_tagks, final boolean include_agg_tags) { |
| 92 | this.id = id; |
| 93 | this.union_on_query_tagks = union_on_query_tagks; |
| 94 | this.include_agg_tags = include_agg_tags; |
| 95 | timestamp = Long.MAX_VALUE; |
| 96 | queries = new HashMap<String, ITimeSyncedIterator>(results.size()); |
| 97 | current_values = new HashMap<String, ExpressionDataPoint[]>(results.size()); |
| 98 | single_series_matrix = new HashMap<String, int[]>(results.size()); |
| 99 | index_to_names = new String[results.size()]; |
| 100 | fill_policy = new NumericFillPolicy(FillPolicy.ZERO); |
| 101 | fill_dp = new ExpressionDataPoint(); |
| 102 | |
| 103 | int i = 0; |
| 104 | for (final Map.Entry<String, ITimeSyncedIterator> entry : results.entrySet()) { |
| 105 | if (LOG.isDebugEnabled()) { |
| 106 | LOG.debug("Adding iterator " + entry.getValue()); |
| 107 | } |
| 108 | queries.put(entry.getKey(), entry.getValue()); |
| 109 | entry.getValue().setIndex(i); |
| 110 | index_to_names[i] = entry.getKey(); |
| 111 | ++i; |
| 112 | } |
| 113 | |
| 114 | computeUnion(); |
| 115 | |
| 116 | // calculate the starting timestamp from the various iterators |
| 117 | for (final ITimeSyncedIterator it : queries.values()) { |
| 118 | final long ts = it.nextTimestamp(); |
| 119 | if (ts < timestamp) { |
| 120 | timestamp = ts; |
| 121 | } |
| 122 | } |
| 123 | |
| 124 | if (LOG.isDebugEnabled()) { |
| 125 | LOG.debug("Computed union: " + this); |
| 126 | } |
| 127 | } |
| 128 | |
| 129 | /** |
| 130 | * Private copy constructor that copies references and sets up new collections |
nothing calls this directly
no test coverage detected