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

Method byteRegexToString

src/query/QueryUtil.java:615–641  ·  view source on GitHub ↗

Little helper to print out the regular expression by converting the UID bytes to an array. @param regexp The regex string to print to the debug log

(final String regexp)

Source from the content-addressed store, hash-verified

613 * @param regexp The regex string to print to the debug log
614 */
615 public static String byteRegexToString(final String regexp) {
616 final StringBuilder buf = new StringBuilder();
617 for (int i = 0; i < regexp.length(); i++) {
618 if (i > 0 && regexp.charAt(i - 1) == 'Q') {
619 if (regexp.charAt(i - 3) == '*') {
620 // tagk
621 byte[] tagk = new byte[TSDB.tagk_width()];
622 for (int x = 0; x < TSDB.tagk_width(); x++) {
623 tagk[x] = (byte)regexp.charAt(i + x);
624 }
625 i += TSDB.tagk_width();
626 buf.append(Arrays.toString(tagk));
627 } else {
628 // tagv
629 byte[] tagv = new byte[TSDB.tagv_width()];
630 for (int x = 0; x < TSDB.tagv_width(); x++) {
631 tagv[x] = (byte)regexp.charAt(i + x);
632 }
633 i += TSDB.tagv_width();
634 buf.append(Arrays.toString(tagv));
635 }
636 } else {
637 buf.append(regexp.charAt(i));
638 }
639 }
640 return buf.toString();
641 }
642
643 /**
644 * Compares two timestamps where either can be in seconds or milliseconds.

Callers 3

getScannerMethod · 0.95
getRowKeyRegexMethod · 0.95

Calls 4

tagk_widthMethod · 0.95
tagv_widthMethod · 0.95
appendMethod · 0.45
toStringMethod · 0.45

Tested by

no test coverage detected