@Override public byte[] getQualifierArray() { return this.kv.getQualifierArray(); }
protected static String getQualifierString(final KeyValue kv) { return Bytes.toStringBinary(kv.getQualifierArray(), kv.getQualifierOffset(), kv.getQualifierLength()); }
/** * Produces a string map for this key/value pair. Useful for programmatic use * and manipulation of the data stored in an WALKey, for example, printing * as JSON. Values are left out due to their tendency to be large. If needed, * they can be added manually. * * @return the Map<String,?> containing data from this key */ public Map<String, Object> toStringMap() { Map<String, Object> stringMap = new HashMap<>(); stringMap.put("row", Bytes.toStringBinary(getRowArray(), getRowOffset(), getRowLength())); stringMap.put("family", Bytes.toStringBinary(getFamilyArray(), getFamilyOffset(), getFamilyLength())); stringMap.put("qualifier", Bytes.toStringBinary(getQualifierArray(), getQualifierOffset(), getQualifierLength())); stringMap.put("timestamp", getTimestamp()); stringMap.put("vlen", getValueLength()); Iterator<Tag> tags = getTags(); if (tags != null) { List<String> tagsString = new ArrayList<String>(); while (tags.hasNext()) { tagsString.add(tags.next().toString()); } stringMap.put("tag", tagsString); } return stringMap; }
private static String qualStr(KeyValue kv) { return Bytes.toString(kv.getQualifierArray(), kv.getQualifierOffset(), kv.getQualifierLength()); }
assertTrue(Bytes.equals(kv.getFamilyArray(), kv.getFamilyOffset(), kv.getFamilyLength(), cf, 0, cf.length)); assertTrue(Bytes.equals(kv.getQualifierArray(), kv.getQualifierOffset(), kv.getQualifierLength(), q, 0, q.length)); assertTrue(Bytes.equals(kv.getValueArray(), kv.getValueOffset(), kv.getValueLength(), value, 0,
/** * Check to see if the kvs in the update match any of the passed columns. Generally, this is useful to for an index * codec to determine if a given update should even be indexed. This assumes that for any index, there are going to * small number of kvs, versus the number of columns in any one batch. * <p> * This employs the same logic as {@link #updateMatchesColumns(Collection, List)}, but is flips the iteration logic * to search columns before kvs. */ public static boolean columnMatchesUpdate(List<ColumnReference> columns, Collection<KeyValue> update) { boolean matches = false; outer: for (ColumnReference ref : columns) { for (KeyValue kv : update) { if (ref.matchesFamily(kv.getFamilyArray(), kv.getFamilyOffset(), kv.getFamilyLength()) && ref.matchesQualifier(kv.getQualifierArray(), kv.getQualifierOffset(), kv.getQualifierLength())) { matches = true; // if a single column matches a single kv, we need to build a whole scanner break outer; } } } return matches; }
/** * check to see if the kvs in the update match any of the passed columns. Generally, this is useful to for an index * codec to determine if a given update should even be indexed. This assumes that for any index, there are going to * small number of columns, versus the number of kvs in any one batch. */ public static boolean updateMatchesColumns(Collection<KeyValue> update, List<ColumnReference> columns) { // check to see if the kvs in the new update even match any of the columns requested // assuming that for any index, there are going to small number of columns, versus the number of // kvs in any one batch. boolean matches = false; outer: for (KeyValue kv : update) { for (ColumnReference ref : columns) { if (ref.matchesFamily(kv.getFamilyArray(), kv.getFamilyOffset(), kv.getFamilyLength()) && ref.matchesQualifier(kv.getQualifierArray(), kv.getQualifierOffset(), kv.getQualifierLength())) { matches = true; // if a single column matches a single kv, we need to build a whole scanner break outer; } } } return matches; }
/** * @return the backing array of the entire KeyValue (all KeyValue fields are * in a single array) */ @Override public byte[] getQualifierArray() { return this.kv.getQualifierArray(); }
@Override public byte[] getQualifierArray() { return this.kv.getQualifierArray(); }
@Override public byte[] getQualifierArray() { return this.kv.getQualifierArray(); }
protected static String getQualifierString(final KeyValue kv) { return Bytes.toStringBinary(kv.getQualifierArray(), kv.getQualifierOffset(), kv.getQualifierLength()); }
protected static String getQualifierString(final KeyValue kv) { return Bytes.toStringBinary(kv.getQualifierArray(), kv.getQualifierOffset(), kv.getQualifierLength()); }
private static String qualStr(KeyValue kv) { return Bytes.toString(kv.getQualifierArray(), kv.getQualifierOffset(), kv.getQualifierLength()); }
/** * Determines whether the current cell should be skipped. The cell will be skipped * if the previous keyvalue had the same key as the current cell. This means filter already responded * for the previous keyvalue with ReturnCode.NEXT_COL or ReturnCode.INCLUDE_AND_NEXT_COL. * @param cell the {@link Cell} to be tested for skipping * @return true is current cell should be skipped, false otherwise */ private boolean skipCellVersion(Cell cell) { return skipColumn != null && CellUtil.matchingRow(cell, skipColumn.getRowArray(), skipColumn.getRowOffset(), skipColumn.getRowLength()) && CellUtil.matchingFamily(cell, skipColumn.getFamilyArray(), skipColumn.getFamilyOffset(), skipColumn.getFamilyLength()) && CellUtil.matchingQualifier(cell, skipColumn.getQualifierArray(), skipColumn.getQualifierOffset(), skipColumn.getQualifierLength()); }
/** * Determines whether the current cell should be skipped. The cell will be skipped * if the previous keyvalue had the same key as the current cell. This means filter already responded * for the previous keyvalue with ReturnCode.NEXT_COL or ReturnCode.INCLUDE_AND_NEXT_COL. * @param cell the {@link Cell} to be tested for skipping * @return true is current cell should be skipped, false otherwise */ private boolean skipCellVersion(Cell cell) { return skipColumn != null && CellUtil.matchingRow(cell, skipColumn.getRowArray(), skipColumn.getRowOffset(), skipColumn.getRowLength()) && CellUtil.matchingFamily(cell, skipColumn.getFamilyArray(), skipColumn.getFamilyOffset(), skipColumn.getFamilyLength()) && CellUtil.matchingQualifier(cell, skipColumn.getQualifierArray(), skipColumn.getQualifierOffset(), skipColumn.getQualifierLength()); }
/** * Determines whether the current cell should be skipped. The cell will be skipped * if the previous keyvalue had the same key as the current cell. This means filter already responded * for the previous keyvalue with ReturnCode.NEXT_COL or ReturnCode.INCLUDE_AND_NEXT_COL. * @param cell the {@link Cell} to be tested for skipping * @return true is current cell should be skipped, false otherwise */ private boolean skipCellVersion(Cell cell) { return skipColumn != null && CellUtil.matchingRow(cell, skipColumn.getRowArray(), skipColumn.getRowOffset(), skipColumn.getRowLength()) && CellUtil.matchingFamily(cell, skipColumn.getFamilyArray(), skipColumn.getFamilyOffset(), skipColumn.getFamilyLength()) && CellUtil.matchingQualifier(cell, skipColumn.getQualifierArray(), skipColumn.getQualifierOffset(), skipColumn.getQualifierLength()); }
/** * Determines whether the current cell should be skipped. The cell will be skipped * if the previous keyvalue had the same key as the current cell. This means filter already responded * for the previous keyvalue with ReturnCode.NEXT_COL or ReturnCode.INCLUDE_AND_NEXT_COL. * @param cell the {@link Cell} to be tested for skipping * @return true is current cell should be skipped, false otherwise */ private boolean skipCellVersion(Cell cell) { return skipColumn != null && CellUtil.matchingRow(cell, skipColumn.getRowArray(), skipColumn.getRowOffset(), skipColumn.getRowLength()) && CellUtil.matchingFamily(cell, skipColumn.getFamilyArray(), skipColumn.getFamilyOffset(), skipColumn.getFamilyLength()) && CellUtil.matchingQualifier(cell, skipColumn.getQualifierArray(), skipColumn.getQualifierOffset(), skipColumn.getQualifierLength()); }
/** * Determines whether the current cell should be skipped. The cell will be skipped * if the previous keyvalue had the same key as the current cell. This means filter already responded * for the previous keyvalue with ReturnCode.NEXT_COL or ReturnCode.INCLUDE_AND_NEXT_COL. * @param cell the {@link Cell} to be tested for skipping * @return true is current cell should be skipped, false otherwise */ private boolean skipCellVersion(Cell cell) { return skipColumn != null && CellUtil.matchingRow(cell, skipColumn.getRowArray(), skipColumn.getRowOffset(), skipColumn.getRowLength()) && CellUtil.matchingFamily(cell, skipColumn.getFamilyArray(), skipColumn.getFamilyOffset(), skipColumn.getFamilyLength()) && CellUtil.matchingQualifier(cell, skipColumn.getQualifierArray(), skipColumn.getQualifierOffset(), skipColumn.getQualifierLength()); }
/** * Determines whether the current cell should be skipped. The cell will be skipped * if the previous keyvalue had the same key as the current cell. This means filter already responded * for the previous keyvalue with ReturnCode.NEXT_COL or ReturnCode.INCLUDE_AND_NEXT_COL. * @param cell the {@link Cell} to be tested for skipping * @return true is current cell should be skipped, false otherwise */ private boolean skipCellVersion(Cell cell) { return skipColumn != null && CellUtil.matchingRow(cell, skipColumn.getRowArray(), skipColumn.getRowOffset(), skipColumn.getRowLength()) && CellUtil.matchingFamily(cell, skipColumn.getFamilyArray(), skipColumn.getFamilyOffset(), skipColumn.getFamilyLength()) && CellUtil.matchingQualifier(cell, skipColumn.getQualifierArray(), skipColumn.getQualifierOffset(), skipColumn.getQualifierLength()); }
/** * Creates the first KV with the row/family/qualifier of this KV and the * given timestamp. Uses the "maximum" KV type that guarantees that the new * KV is the lowest possible for this combination of row, family, qualifier, * and timestamp. This KV's own timestamp is ignored. While this function * copies the value from this KV, it is normally used on key-only KVs. */ public static KeyValue createFirstOnRowColTS(KeyValue kv, long ts) { return new KeyValue( kv.getRowArray(), kv.getRowOffset(), kv.getRowLength(), kv.getFamilyArray(), kv.getFamilyOffset(), kv.getFamilyLength(), kv.getQualifierArray(), kv.getQualifierOffset(), kv.getQualifierLength(), ts, Type.Maximum, kv.getValueArray(), kv.getValueOffset(), kv.getValueLength()); }