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

Method runMultiCompact

test/core/TestTsdbQueryQueries.java:1250–1303  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1248 }
1249
1250 @Test
1251 public void runMultiCompact() throws Exception {
1252 final byte[] qual1 = { 0x00, 0x17 };
1253 final byte[] val1 = Bytes.fromLong(1L);
1254 final byte[] qual2 = { 0x00, 0x27 };
1255 final byte[] val2 = Bytes.fromLong(2L);
1256
1257 // 2nd compaction
1258 final byte[] qual3 = { 0x00, 0x37 };
1259 final byte[] val3 = Bytes.fromLong(3L);
1260 final byte[] qual4 = { 0x00, 0x47 };
1261 final byte[] val4 = Bytes.fromLong(4L);
1262
1263 // 3rd compaction
1264 final byte[] qual5 = { 0x00, 0x57 };
1265 final byte[] val5 = Bytes.fromLong(5L);
1266 final byte[] qual6 = { 0x00, 0x67 };
1267 final byte[] val6 = Bytes.fromLong(6L);
1268
1269 final byte[] key = IncomingDataPoints.rowKeyTemplate(tsdb, METRIC_STRING, tags);
1270 RowKey.prefixKeyWithSalt(key);
1271 System.arraycopy(Bytes.fromInt(1356998400), 0, key,
1272 Const.SALT_WIDTH() + TSDB.metrics_width(), Const.TIMESTAMP_BYTES);
1273
1274 setDataPointStorage();
1275 storage.addColumn(key,
1276 MockBase.concatByteArrays(qual1, qual2),
1277 MockBase.concatByteArrays(val1, val2, new byte[] { 0 }));
1278 storage.addColumn(key,
1279 MockBase.concatByteArrays(qual3, qual4),
1280 MockBase.concatByteArrays(val3, val4, new byte[] { 0 }));
1281 storage.addColumn(key,
1282 MockBase.concatByteArrays(qual5, qual6),
1283 MockBase.concatByteArrays(val5, val6, new byte[] { 0 }));
1284
1285 HashMap<String, String> tags = new HashMap<String, String>(1);
1286 tags.put(TAGK_STRING , TAGV_STRING );
1287 query.setStartTime(1356998400);
1288 query.setEndTime(1357041600);
1289 query.setTimeSeries(METRIC_STRING, tags, Aggregators.SUM, false);
1290
1291 final DataPoints[] dps = query.run();
1292 assertMeta(dps, 0, false);
1293
1294 int value = 1;
1295 long timestamp = 1356998401000L;
1296 for (DataPoint dp : dps[0]) {
1297 assertEquals(value, dp.longValue());
1298 assertEquals(timestamp, dp.timestamp());
1299 value++;
1300 timestamp += 1000;
1301 }
1302 assertEquals(6, dps[0].aggregatedSize());
1303 }
1304
1305 @Test
1306 public void runMultiCompactAndSingles() throws Exception {

Callers

nothing calls this directly

Calls 15

rowKeyTemplateMethod · 0.95
prefixKeyWithSaltMethod · 0.95
SALT_WIDTHMethod · 0.95
metrics_widthMethod · 0.95
concatByteArraysMethod · 0.95
setDataPointStorageMethod · 0.80
addColumnMethod · 0.80
putMethod · 0.80
assertMetaMethod · 0.80
setStartTimeMethod · 0.65
setEndTimeMethod · 0.65
setTimeSeriesMethod · 0.65

Tested by

no test coverage detected