public static Pair<Long, String> decodeColQual(byte[] colQual) { return colQualCoder.decode(colQual); }
public static Pair<String, Long> decodeRowKey(Key k) { return rowCoder.decode(k.getRow().getBytes()); } }
@Override public String next() { Entry<Key, Value> e = getScannerIterator().next(); StringBuilder b = new StringBuilder(); ComparablePair<String, Long> p = rowCoder.decode(e.getKey().getRow().copyBytes()); b.append(p.getFirst()).append("\\x00").append(p.getSecond()); b.append(" "); b.append(e.getKey().getColumnFamily().toString()); b.append(":"); ComparablePair<Long, String> cq = colQualCoder.decode(e.getKey().getColumnQualifier().copyBytes()); b.append(cq.getFirst()).append("\\x00").append(cq.getSecond()); b.append(" "); b.append(e.getKey().getColumnVisibility().toString()); if (super.isDoTimestamps()) { b.append(" "); b.append(e.getKey().getTimestamp()); } b.append(" "); ByteBuffer.wrap(e.getValue().get()); b.append(ByteBuffer.wrap(e.getValue().get()).getDouble()); return b.toString(); }
public static Metric parse(Key k, Value v, boolean includeVizTag) { ComparablePair<String, Long> row = rowCoder.decode(k.getRow().getBytes()); // @formatter:off Metric.Builder builder = Metric.newBuilder() .name(row.getFirst()) .value(k.getTimestamp(), ByteBuffer.wrap(v.get()).getDouble()) .tag(tagParser.parse(k.getColumnFamily().toString())); // @formatter:on ComparablePair<Long, String> cq = colQualCoder.decode(k.getColumnQualifier().getBytes()); tagListParser.parse(cq.getSecond()).forEach(builder::tag); if (includeVizTag && k.getColumnVisibility().getLength() > 0) { tagListParser.parse("viz=" + k.getColumnVisibility().toString()).forEach(builder::tag); } return builder.build(); }