Java Code Examples for org.apache.hadoop.hbase.Cell#getTagsOffset()

The following examples show how to use org.apache.hadoop.hbase.Cell#getTagsOffset() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: HalyardBulkDelete.java    From Halyard with Apache License 2.0 6 votes vote down vote up
@Override
protected void map(ImmutableBytesWritable key, Result value, Context output) throws IOException, InterruptedException {
    for (Cell c : value.rawCells()) {
        Statement st = HalyardTableUtils.parseStatement(c, SVF);
        if ((subj == null || subj.equals(st.getSubject())) && (pred == null || pred.equals(st.getPredicate())) && (obj == null || obj.equals(st.getObject())) && (ctx == null || ctx.contains(st.getContext()))) {
            KeyValue kv = new KeyValue(c.getRowArray(), c.getRowOffset(), (int) c.getRowLength(),
                c.getFamilyArray(), c.getFamilyOffset(), (int) c.getFamilyLength(),
                c.getQualifierArray(), c.getQualifierOffset(), c.getQualifierLength(),
                c.getTimestamp(), KeyValue.Type.DeleteColumn, c.getValueArray(), c.getValueOffset(),
                c.getValueLength(), c.getTagsArray(), c.getTagsOffset(), c.getTagsLength());
            output.write(new ImmutableBytesWritable(kv.getRowArray(), kv.getRowOffset(), kv.getRowLength()), kv);
            deleted++;
        } else {
            output.progress();
        }
        if (total++ % 10000l == 0) {
            String msg = MessageFormat.format("{0} / {1} cells deleted", deleted, total);
            output.setStatus(msg);
            LOG.log(Level.INFO, msg);
        }
    }

}
 
Example 2
Source File: LocalIndexStoreFileScanner.java    From phoenix with Apache License 2.0 5 votes vote down vote up
private Cell getChangedKey(Cell next, boolean changeBottomKeys) {
    // If it is a top store file change the StartKey with SplitKey in Key
    //and produce the new value corresponding to the change in key
    byte[] changedKey = getNewRowkeyByRegionStartKeyReplacedWithSplitKey(next, changeBottomKeys);
    KeyValue changedKv =
            new KeyValue(changedKey, 0, changedKey.length, next.getFamilyArray(),
                next.getFamilyOffset(), next.getFamilyLength(), next.getQualifierArray(),
                next.getQualifierOffset(), next.getQualifierLength(),
                next.getTimestamp(), Type.codeToType(next.getTypeByte()),
                next.getValueArray(), next.getValueOffset(), next.getValueLength(),
                next.getTagsArray(), next.getTagsOffset(), next.getTagsLength());
    return changedKv;
}
 
Example 3
Source File: MergingServerOp.java    From geowave with Apache License 2.0 4 votes vote down vote up
protected Cell mergeList(final List<Cell> cells) {
  synchronized (MUTEX) {
    Mergeable currentMergeable = null;
    final Cell firstCell = cells.get(0);
    for (final Cell cell : cells) {
      final Mergeable mergeable =
          getMergeable(
              cell,
              // TODO consider avoiding extra byte array
              // allocations (which would require
              // persistence utils to be able to use
              // bytebuffer instead of byte[])
              CellUtil.cloneValue(cell));
      if (mergeable != null) {
        if (currentMergeable == null) {
          currentMergeable = mergeable;
        } else {
          currentMergeable.merge(mergeable);
        }
      }
    }
    final byte[] valueBinary = getBinary(currentMergeable);
    // this is basically a lengthy verbose form of cloning
    // in-place (without allocating new byte arrays) and
    // simply replacing the value with the new mergeable
    // value
    return new KeyValue(
        firstCell.getRowArray(),
        firstCell.getRowOffset(),
        firstCell.getRowLength(),
        firstCell.getFamilyArray(),
        firstCell.getFamilyOffset(),
        firstCell.getFamilyLength(),
        firstCell.getQualifierArray(),
        firstCell.getQualifierOffset(),
        firstCell.getQualifierLength(),
        firstCell.getTimestamp(),
        Type.codeToType(firstCell.getTypeByte()),
        valueBinary,
        0,
        valueBinary.length,
        firstCell.getTagsArray(),
        firstCell.getTagsOffset(),
        firstCell.getTagsLength());
  }
}