Java Code Examples for org.apache.hadoop.hbase.KeyValue.Type#codeToType()
The following examples show how to use
org.apache.hadoop.hbase.KeyValue.Type#codeToType() .
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: NewVersionBehaviorTracker.java From hbase with Apache License 2.0 | 6 votes |
@Override public void add(Cell cell) { prepare(cell); byte type = cell.getTypeByte(); switch (Type.codeToType(type)) { // By the order of seen. We put null cq at first. case DeleteFamily: // Delete all versions of all columns of the specified family delFamMap.put(cell.getSequenceId(), new DeleteVersionsNode(cell.getTimestamp(), cell.getSequenceId())); break; case DeleteFamilyVersion: // Delete all columns of the specified family and specified version delFamMap.ceilingEntry(cell.getSequenceId()).getValue().addVersionDelete(cell); break; // These two kinds of markers are mix with Puts. case DeleteColumn: // Delete all versions of the specified column delColMap.put(cell.getSequenceId(), new DeleteVersionsNode(cell.getTimestamp(), cell.getSequenceId())); break; case Delete: // Delete the specified version of the specified column. delColMap.ceilingEntry(cell.getSequenceId()).getValue().addVersionDelete(cell); break; default: throw new AssertionError("Unknown delete marker type for " + cell); } }
Example 2
Source File: SchemaUtil.java From phoenix with BSD 3-Clause "New" or "Revised" License | 6 votes |
private static KeyValue upgradeTo3(KeyValue keyValue) { byte[] buf = keyValue.getBuffer(); int newLength = keyValue.getRowLength() + 1; byte[] newKey = new byte[newLength]; newKey[0] = QueryConstants.SEPARATOR_BYTE; System.arraycopy(buf, keyValue.getRowOffset(), newKey, 1, keyValue.getRowLength()); byte[] valueBuf = updateValueIfNecessary(keyValue); int valueOffset = keyValue.getValueOffset(); int valueLength = keyValue.getValueLength(); if (valueBuf != buf) { valueOffset = 0; valueLength = valueBuf.length; } return new KeyValue(newKey, 0, newLength, buf, keyValue.getFamilyOffset(), keyValue.getFamilyLength(), buf, keyValue.getQualifierOffset(), keyValue.getQualifierLength(), keyValue.getTimestamp(), Type.codeToType(keyValue.getType()), valueBuf, valueOffset, valueLength); }
Example 3
Source File: LocalIndexStoreFileScanner.java From phoenix with Apache License 2.0 | 5 votes |
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 4
Source File: MergingServerOp.java From geowave with Apache License 2.0 | 4 votes |
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()); } }