Computes the union of all sets, matching on tags and optionally the aggregated tags across each variable.
()
| 169 | * aggregated tags across each variable. |
| 170 | */ |
| 171 | private void computeUnion() { |
| 172 | // key = flattened tags, array of queries.size() |
| 173 | final ByteMap<ExpressionDataPoint[]> ordered_union = |
| 174 | new ByteMap<ExpressionDataPoint[]>(); |
| 175 | |
| 176 | final Iterator<ITimeSyncedIterator> it = queries.values().iterator(); |
| 177 | while (it.hasNext()) { |
| 178 | final ITimeSyncedIterator sub = it.next(); |
| 179 | final ExpressionDataPoint[] dps = sub.values(); |
| 180 | final ByteMap<Integer> local_tags = new ByteMap<Integer>(); |
| 181 | |
| 182 | for (int i = 0; i < sub.size(); i++) { |
| 183 | final byte[] key = flattenTags(union_on_query_tagks, include_agg_tags, |
| 184 | dps[i], sub); |
| 185 | local_tags.put(key, i); |
| 186 | ExpressionDataPoint[] udps = ordered_union.get(key); |
| 187 | if (udps == null) { |
| 188 | udps = new ExpressionDataPoint[queries.size()]; |
| 189 | ordered_union.put(key, udps); |
| 190 | } |
| 191 | udps[sub.getIndex()] = dps[i]; |
| 192 | } |
| 193 | } |
| 194 | |
| 195 | if (ordered_union.size() < 1) { |
| 196 | // if no data, just stop here |
| 197 | return; |
| 198 | } |
| 199 | |
| 200 | setCurrentAndMeta(ordered_union); |
| 201 | } |
| 202 | |
| 203 | /** |
| 204 | * Takes the resulting union and builds the {@link #current_values} |
no test coverage detected