org.apache.hadoop.hbase.KeyValue.getFamilyArray()方法的使用及代码示例

x33g5p2x  于2022-01-23 转载在 其他  
字(11.9k)|赞(0)|评价(0)|浏览(93)

本文整理了Java中org.apache.hadoop.hbase.KeyValue.getFamilyArray()方法的一些代码示例,展示了KeyValue.getFamilyArray()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。KeyValue.getFamilyArray()方法的具体详情如下:
包路径:org.apache.hadoop.hbase.KeyValue
类名称:KeyValue
方法名:getFamilyArray

KeyValue.getFamilyArray介绍

暂无

代码示例

代码示例来源:origin: apache/hbase

@Override
public byte[] getFamilyArray() {
 return this.kv.getFamilyArray();
}

代码示例来源:origin: apache/hbase

protected static String getFamilyString(final KeyValue kv) {
 return Bytes.toStringBinary(kv.getFamilyArray(), kv.getFamilyOffset(), kv.getFamilyLength());
}

代码示例来源:origin: apache/hbase

/**
 * 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;
}

代码示例来源:origin: apache/hbase

assertTrue(Bytes.equals(kv.getRowArray(), kv.getRowOffset(), kv.getRowLength(), row, 0,
 row.length));
assertTrue(Bytes.equals(kv.getFamilyArray(), kv.getFamilyOffset(), kv.getFamilyLength(), cf, 0,
 cf.length));
assertTrue(Bytes.equals(kv.getQualifierArray(), kv.getQualifierOffset(),

代码示例来源:origin: apache/phoenix

/**
 * 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;
}

代码示例来源:origin: apache/phoenix

/**
 * 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;
}

代码示例来源:origin: com.aliyun.hbase/alihbase-common

/**
 * @return the backing array of the entire KeyValue (all KeyValue fields are
 *         in a single array)
 */
@Override
public byte[] getFamilyArray() {
 return this.kv.getFamilyArray();
}

代码示例来源:origin: org.apache.hbase/hbase-common

@Override
public byte[] getFamilyArray() {
 return this.kv.getFamilyArray();
}

代码示例来源:origin: com.aliyun.hbase/alihbase-common

@Override
public byte[] getFamilyArray() {
 return this.kv.getFamilyArray();
}

代码示例来源:origin: org.apache.hbase/hbase-common

protected static String getFamilyString(final KeyValue kv) {
 return Bytes.toStringBinary(kv.getFamilyArray(), kv.getFamilyOffset(), kv.getFamilyLength());
}

代码示例来源:origin: com.aliyun.hbase/alihbase-common

protected static String getFamilyString(final KeyValue kv) {
 return Bytes.toStringBinary(kv.getFamilyArray(), kv.getFamilyOffset(), kv.getFamilyLength());
}

代码示例来源:origin: Merck/Halyard

@Override
protected void delete(KeyValue kv) throws IOException {
  kv = new KeyValue(kv.getRowArray(), kv.getRowOffset(), (int) kv.getRowLength(),
      kv.getFamilyArray(), kv.getFamilyOffset(), (int) kv.getFamilyLength(),
      kv.getQualifierArray(), kv.getQualifierOffset(), kv.getQualifierLength(),
      kv.getTimestamp(), KeyValue.Type.DeleteColumn, kv.getValueArray(), kv.getValueOffset(),
      kv.getValueLength(), kv.getTagsArray(), kv.getTagsOffset(), kv.getTagsLength());
  try {
    context.write(new ImmutableBytesWritable(kv.getRowArray(), kv.getRowOffset(), kv.getRowLength()), kv);
  } catch (InterruptedException ex) {
    throw new IOException(ex);
  }
  if (added.incrementAndGet() % 1000l == 0) {
    context.setStatus(name + " - " + added.get() + " added " + removed.get() + " removed");
    LOG.log(Level.INFO, "{0} KeyValues added and {1} removed", new Object[] {added.get(), removed.get()});
  }
}

代码示例来源:origin: co.cask.tephra/tephra-hbase-compat-1.0

/**
 * 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());
}

代码示例来源:origin: org.apache.tephra/tephra-hbase-compat-1.1

/**
 * 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());
}

代码示例来源:origin: org.apache.tephra/tephra-hbase-compat-1.0

/**
 * 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());
}

代码示例来源:origin: co.cask.tephra/tephra-hbase-compat-1.1

/**
 * 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());
}

代码示例来源:origin: org.apache.tephra/tephra-hbase-compat-1.0-cdh

/**
 * 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());
}

代码示例来源:origin: caskdata/tephra

/**
 * 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());
}

代码示例来源:origin: caskdata/tephra

/**
 * 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());
}

代码示例来源:origin: harbby/presto-connectors

/**
 * 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());
}

相关文章

微信公众号

最新文章

更多

KeyValue类方法