當前位置: 首頁>>代碼示例>>Java>>正文


Java CellUtil.getRowByte方法代碼示例

本文整理匯總了Java中org.apache.hadoop.hbase.CellUtil.getRowByte方法的典型用法代碼示例。如果您正苦於以下問題:Java CellUtil.getRowByte方法的具體用法?Java CellUtil.getRowByte怎麽用?Java CellUtil.getRowByte使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.hadoop.hbase.CellUtil的用法示例。


在下文中一共展示了CellUtil.getRowByte方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: compareToCurrentToken

import org.apache.hadoop.hbase.CellUtil; //導入方法依賴的package包/類
/**
 * Compare only the bytes within the window of the current token
 * @param key
 * @return return -1 if key is lessThan (before) this, 0 if equal, and 1 if key is after
 */
protected int compareToCurrentToken(Cell key) {
  int startIndex = rowLength - currentRowNode.getTokenLength();
  int endIndexExclusive = startIndex + currentRowNode.getTokenLength();
  for (int i = startIndex; i < endIndexExclusive; ++i) {
    if (i >= key.getRowLength()) {// key was shorter, so it's first
      return -1;
    }
    byte keyByte = CellUtil.getRowByte(key, i);
    byte thisByte = rowBuffer[i];
    if (keyByte == thisByte) {
      continue;
    }
    return UnsignedBytes.compare(keyByte, thisByte);
  }
  if (!currentRowNode.hasOccurrences() && rowLength >= key.getRowLength()) { // key was shorter
      return -1;
  }
  return 0;
}
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:25,代碼來源:PrefixTreeArraySearcher.java

示例2: positionAtOrBefore

import org.apache.hadoop.hbase.CellUtil; //導入方法依賴的package包/類
@Override
public CellScannerPosition positionAtOrBefore(Cell key) {
  reInitFirstNode();
  int fanIndex = -1;

  while(true){
    //detect row mismatch.  break loop if mismatch
    int currentNodeDepth = rowLength;
    int rowTokenComparison = compareToCurrentToken(key);
    if(rowTokenComparison != 0){
      return fixRowTokenMissReverse(rowTokenComparison);
    }

    //exact row found, move on to qualifier & ts
    if(rowMatchesAfterCurrentPosition(key)){
      return positionAtQualifierTimestamp(key, true);
    }

    //detect dead end (no fan to descend into)
    if(!currentRowNode.hasFan()){
      if(hasOccurrences()){//must be leaf or nub
        populateLastNonRowFields();
        return CellScannerPosition.BEFORE;
      }else{
        //TODO i don't think this case is exercised by any tests
        return fixRowFanMissReverse(0);
      }
    }

    //keep hunting for the rest of the row
    byte searchForByte = CellUtil.getRowByte(key, currentNodeDepth);
    fanIndex = currentRowNode.whichFanNode(searchForByte);
    if(fanIndex < 0){//no matching row.  return early
      int insertionPoint = -fanIndex - 1;
      return fixRowFanMissReverse(insertionPoint);
    }
    //found a match, so dig deeper into the tree
    followFan(fanIndex);
  }
}
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:41,代碼來源:PrefixTreeArraySearcher.java

示例3: positionAtOrAfter

import org.apache.hadoop.hbase.CellUtil; //導入方法依賴的package包/類
/**
 * Identical workflow as positionAtOrBefore, but split them to avoid having ~10 extra
 * if-statements. Priority on readability and debugability.
 */
@Override
public CellScannerPosition positionAtOrAfter(Cell key) {
  reInitFirstNode();
  int fanIndex = -1;

  while(true){
    //detect row mismatch.  break loop if mismatch
    int currentNodeDepth = rowLength;
    int rowTokenComparison = compareToCurrentToken(key);
    if(rowTokenComparison != 0){
      return fixRowTokenMissForward(rowTokenComparison);
    }

    //exact row found, move on to qualifier & ts
    if(rowMatchesAfterCurrentPosition(key)){
      return positionAtQualifierTimestamp(key, false);
    }

    //detect dead end (no fan to descend into)
    if(!currentRowNode.hasFan()){
      if(hasOccurrences()){
        if (rowLength < key.getRowLength()) {
          nextRow();
        } else {
          populateFirstNonRowFields();
        }
        return CellScannerPosition.AFTER;
      }else{
        //TODO i don't think this case is exercised by any tests
        return fixRowFanMissForward(0);
      }
    }

    //keep hunting for the rest of the row
    byte searchForByte = CellUtil.getRowByte(key, currentNodeDepth);
    fanIndex = currentRowNode.whichFanNode(searchForByte);
    if(fanIndex < 0){//no matching row.  return early
      int insertionPoint = -fanIndex - 1;
      return fixRowFanMissForward(insertionPoint);
    }
    //found a match, so dig deeper into the tree
    followFan(fanIndex);
  }
}
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:49,代碼來源:PrefixTreeArraySearcher.java


注:本文中的org.apache.hadoop.hbase.CellUtil.getRowByte方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。