本文整理汇总了Java中org.apache.hadoop.hbase.CellUtil.matchingColumn方法的典型用法代码示例。如果您正苦于以下问题:Java CellUtil.matchingColumn方法的具体用法?Java CellUtil.matchingColumn怎么用?Java CellUtil.matchingColumn使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.hadoop.hbase.CellUtil
的用法示例。
在下文中一共展示了CellUtil.matchingColumn方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getColumnCells
import org.apache.hadoop.hbase.CellUtil; //导入方法依赖的package包/类
/**
* Return the Cells for the specific column. The Cells are sorted in
* the {@link KeyValue#COMPARATOR} order. That implies the first entry in
* the list is the most recent column. If the query (Scan or Get) only
* requested 1 version the list will contain at most 1 entry. If the column
* did not exist in the result set (either the column does not exist
* or the column was not selected in the query) the list will be empty.
*
* Also see getColumnLatest which returns just a Cell
*
* @param family the family
* @param qualifier
* @return a list of Cells for this column or empty list if the column
* did not exist in the result set
*/
public List<Cell> getColumnCells(byte [] family, byte [] qualifier) {
List<Cell> result = new ArrayList<Cell>();
Cell [] kvs = rawCells();
if (kvs == null || kvs.length == 0) {
return result;
}
int pos = binarySearch(kvs, family, qualifier);
if (pos == -1) {
return result; // cant find it
}
for (int i = pos ; i < kvs.length ; i++ ) {
if (CellUtil.matchingColumn(kvs[i], family,qualifier)) {
result.add(kvs[i]);
} else {
break;
}
}
return result;
}
示例2: getColumnLatestCell
import org.apache.hadoop.hbase.CellUtil; //导入方法依赖的package包/类
/**
* The Cell for the most recent timestamp for a given column.
*
* @param family family name
* @param foffset family offset
* @param flength family length
* @param qualifier column qualifier
* @param qoffset qualifier offset
* @param qlength qualifier length
*
* @return the Cell for the column, or null if no value exists in the row or none have been
* selected in the query (Get/Scan)
*/
public Cell getColumnLatestCell(byte [] family, int foffset, int flength,
byte [] qualifier, int qoffset, int qlength) {
Cell [] kvs = rawCells(); // side effect possibly.
if (kvs == null || kvs.length == 0) {
return null;
}
int pos = binarySearch(kvs, family, foffset, flength, qualifier, qoffset, qlength);
if (pos == -1) {
return null;
}
if (CellUtil.matchingColumn(kvs[pos], family, foffset, flength, qualifier, qoffset, qlength)) {
return kvs[pos];
}
return null;
}
示例3: filterKeyValue
import org.apache.hadoop.hbase.CellUtil; //导入方法依赖的package包/类
@Override
public ReturnCode filterKeyValue(Cell c) {
// Check if the column and qualifier match
if (!CellUtil.matchingColumn(c, this.columnFamily, this.columnQualifier)) {
// include non-matches for the time being, they'll be discarded afterwards
return ReturnCode.INCLUDE;
}
// If it doesn't pass the op, skip it
if (comparator != null
&& doCompare(compareOp, comparator, c.getValueArray(), c.getValueOffset(),
c.getValueLength()))
return ReturnCode.SKIP;
stampSet.add(c.getTimestamp());
if(dropDependentColumn) {
return ReturnCode.SKIP;
}
return ReturnCode.INCLUDE;
}
示例4: filterKeyValue
import org.apache.hadoop.hbase.CellUtil; //导入方法依赖的package包/类
@Override
public ReturnCode filterKeyValue(Cell c) {
if (this.matchedColumn) {
// We already found and matched the single column, all keys now pass
return ReturnCode.INCLUDE;
} else if (this.latestVersionOnly && this.foundColumn) {
// We found but did not match the single column, skip to next row
return ReturnCode.NEXT_ROW;
}
if (!CellUtil.matchingColumn(c, this.columnFamily, this.columnQualifier)) {
return ReturnCode.INCLUDE;
}
foundColumn = true;
if (filterColumnValue(c.getValueArray(), c.getValueOffset(), c.getValueLength())) {
return this.latestVersionOnly? ReturnCode.NEXT_ROW: ReturnCode.INCLUDE;
}
this.matchedColumn = true;
return ReturnCode.INCLUDE;
}
示例5: getCompaction
import org.apache.hadoop.hbase.CellUtil; //导入方法依赖的package包/类
/**
* Deserialized and returns a CompactionDescriptor is the KeyValue contains one.
* @param kv the key value
* @return deserialized CompactionDescriptor or null.
*/
public static CompactionDescriptor getCompaction(Cell kv) throws IOException {
if (CellUtil.matchingColumn(kv, METAFAMILY, COMPACTION)) {
return CompactionDescriptor.parseFrom(kv.getValue());
}
return null;
}
示例6: getBulkLoadDescriptor
import org.apache.hadoop.hbase.CellUtil; //导入方法依赖的package包/类
/**
* Deserialized and returns a BulkLoadDescriptor from the passed in Cell
* @param cell the key value
* @return deserialized BulkLoadDescriptor or null.
*/
public static WALProtos.BulkLoadDescriptor getBulkLoadDescriptor(Cell cell) throws IOException {
if (CellUtil.matchingColumn(cell, METAFAMILY, BULK_LOAD)) {
return WALProtos.BulkLoadDescriptor.parseFrom(cell.getValue());
}
return null;
}
示例7: filterRowCells
import org.apache.hadoop.hbase.CellUtil; //导入方法依赖的package包/类
@Override
public void filterRowCells(List<Cell> kvs) {
Iterator<? extends Cell> it = kvs.iterator();
while (it.hasNext()) {
Cell cell = it.next();
// If the current column is actually the tested column,
// we will skip it instead.
if (CellUtil.matchingColumn(cell, this.columnFamily, this.columnQualifier)) {
it.remove();
}
}
}
示例8: getFlushDescriptor
import org.apache.hadoop.hbase.CellUtil; //导入方法依赖的package包/类
public static FlushDescriptor getFlushDescriptor(Cell cell) throws IOException {
if (CellUtil.matchingColumn(cell, METAFAMILY, FLUSH)) {
return FlushDescriptor.parseFrom(cell.getValue());
}
return null;
}
示例9: getRegionEventDescriptor
import org.apache.hadoop.hbase.CellUtil; //导入方法依赖的package包/类
public static RegionEventDescriptor getRegionEventDescriptor(Cell cell) throws IOException {
if (CellUtil.matchingColumn(cell, METAFAMILY, REGION_EVENT)) {
return RegionEventDescriptor.parseFrom(cell.getValue());
}
return null;
}
示例10: updateColumnValue
import org.apache.hadoop.hbase.CellUtil; //导入方法依赖的package包/类
/**
* Only used by tests. TODO: Remove
*
* Given the specs of a column, update it, first by inserting a new record,
* then removing the old one. Since there is only 1 KeyValue involved, the memstoreTS
* will be set to 0, thus ensuring that they instantly appear to anyone. The underlying
* store will ensure that the insert/delete each are atomic. A scanner/reader will either
* get the new value, or the old value and all readers will eventually only see the new
* value after the old was removed.
*
* @param row
* @param family
* @param qualifier
* @param newValue
* @param now
* @return Timestamp
*/
@Override
public long updateColumnValue(byte[] row,
byte[] family,
byte[] qualifier,
long newValue,
long now) {
Cell firstCell = KeyValueUtil.createFirstOnRow(row, family, qualifier);
// Is there a Cell in 'snapshot' with the same TS? If so, upgrade the timestamp a bit.
SortedSet<Cell> snSs = snapshot.tailSet(firstCell);
if (!snSs.isEmpty()) {
Cell snc = snSs.first();
// is there a matching Cell in the snapshot?
if (CellUtil.matchingRow(snc, firstCell) && CellUtil.matchingQualifier(snc, firstCell)) {
if (snc.getTimestamp() == now) {
// poop,
now += 1;
}
}
}
// logic here: the new ts MUST be at least 'now'. But it could be larger if necessary.
// But the timestamp should also be max(now, mostRecentTsInMemstore)
// so we cant add the new Cell w/o knowing what's there already, but we also
// want to take this chance to delete some cells. So two loops (sad)
SortedSet<Cell> ss = cellSet.tailSet(firstCell);
for (Cell cell : ss) {
// if this isnt the row we are interested in, then bail:
if (!CellUtil.matchingColumn(cell, family, qualifier)
|| !CellUtil.matchingRow(cell, firstCell)) {
break; // rows dont match, bail.
}
// if the qualifier matches and it's a put, just RM it out of the cellSet.
if (cell.getTypeByte() == KeyValue.Type.Put.getCode() &&
cell.getTimestamp() > now && CellUtil.matchingQualifier(firstCell, cell)) {
now = cell.getTimestamp();
}
}
// create or update (upsert) a new Cell with
// 'now' and a 0 memstoreTS == immediately visible
List<Cell> cells = new ArrayList<Cell>(1);
cells.add(new KeyValue(row, family, qualifier, now, Bytes.toBytes(newValue)));
return upsert(cells, 1L);
}
示例11: matches
import org.apache.hadoop.hbase.CellUtil; //导入方法依赖的package包/类
/**
* Is this cell has matched family and qualifier.
*
* @param family
* @param qualifier
* @return
*/
public boolean matches(byte[] family, byte[] qualifier) {
return CellUtil.matchingColumn(map(), family, qualifier);
}