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


Java Cell.getValueArray方法代碼示例

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


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

示例1: addSize

import org.apache.hadoop.hbase.Cell; //導入方法依賴的package包/類
/**
 * Method to account for the size of retained cells and retained data blocks.
 * @return an object that represents the last referenced block from this response.
 */
Object addSize(RpcCallContext context, Result r, Object lastBlock) {
  if (context != null && !r.isEmpty()) {
    for (Cell c : r.rawCells()) {
      context.incrementResponseCellSize(CellUtil.estimatedHeapSizeOf(c));
      // We're using the last block being the same as the current block as
      // a proxy for pointing to a new block. This won't be exact.
      // If there are multiple gets that bounce back and forth
      // Then it's possible that this will over count the size of
      // referenced blocks. However it's better to over count and
      // use two RPC's than to OOME the RegionServer.
      byte[] valueArray = c.getValueArray();
      if (valueArray != lastBlock) {
        context.incrementResponseBlockSize(valueArray.length);
        lastBlock = valueArray;
      }
    }
  }
  return lastBlock;
}
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:24,代碼來源:RSRpcServices.java

示例2: preWALWrite

import org.apache.hadoop.hbase.Cell; //導入方法依賴的package包/類
@Override
public boolean preWALWrite(ObserverContext<? extends WALCoprocessorEnvironment> env,
    HRegionInfo info, WALKey logKey, WALEdit logEdit) throws IOException {
  boolean bypass = false;
  // check table name matches or not.
  if (!Bytes.equals(info.getTableName(), this.tableName)) {
    return bypass;
  }
  preWALWriteCalled = true;
  // here we're going to remove one keyvalue from the WALEdit, and add
  // another one to it.
  List<Cell> cells = logEdit.getCells();
  Cell deletedCell = null;
  for (Cell cell : cells) {
    // assume only one kv from the WALEdit matches.
    byte[] family = cell.getFamily();
    byte[] qulifier = cell.getQualifier();

    if (Arrays.equals(family, ignoredFamily) &&
        Arrays.equals(qulifier, ignoredQualifier)) {
      LOG.debug("Found the KeyValue from WALEdit which should be ignored.");
      deletedCell = cell;
    }
    if (Arrays.equals(family, changedFamily) &&
        Arrays.equals(qulifier, changedQualifier)) {
      LOG.debug("Found the KeyValue from WALEdit which should be changed.");
      cell.getValueArray()[cell.getValueOffset()] += 1;
    }
  }
  if (null != row) {
    cells.add(new KeyValue(row, addedFamily, addedQualifier));
  }
  if (deletedCell != null) {
    LOG.debug("About to delete a KeyValue from WALEdit.");
    cells.remove(deletedCell);
  }
  return bypass;
}
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:39,代碼來源:SampleRegionWALObserver.java

示例3: getKeyValue

import org.apache.hadoop.hbase.Cell; //導入方法依賴的package包/類
/**
 * currently must do deep copy into new array
 */
@Override
public Cell getKeyValue() {
  Cell cell = ptSearcher.current();
  if (cell == null) {
    return null;
  }
  return new ClonedPrefixTreeCell(cell.getRowArray(), cell.getRowOffset(), cell.getRowLength(),
      cell.getFamilyArray(), cell.getFamilyOffset(), cell.getFamilyLength(),
      cell.getQualifierArray(), cell.getQualifierOffset(), cell.getQualifierLength(),
      cell.getValueArray(), cell.getValueOffset(), cell.getValueLength(), cell.getTagsArray(),
      cell.getTagsOffset(), cell.getTagsLength(), cell.getTimestamp(), cell.getTypeByte(),
      cell.getSequenceId());
}
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:17,代碼來源:PrefixTreeSeeker.java

示例4: append

import org.apache.hadoop.hbase.Cell; //導入方法依賴的package包/類
/**
 * Add key/value to file. Keys must be added in an order that agrees with the
 * Comparator passed on construction.
 *
 * @param cell Cell to add. Cannot be empty nor null.
 * @throws IOException
 */
@Override
public void append(final Cell cell) throws IOException {
  byte[] value = cell.getValueArray();
  int voffset = cell.getValueOffset();
  int vlength = cell.getValueLength();
  // checkKey uses comparator to check we are writing in order.
  boolean dupKey = checkKey(cell);
  checkValue(value, voffset, vlength);
  if (!dupKey) {
    checkBlockBoundary();
  }

  if (!fsBlockWriter.isWriting()) {
    newBlock();
  }

  synchronized (HFileWriterV2.class) {
    if (WARN_CELL_WITH_TAGS && getFileContext().isIncludesTags()) {
      LOG.warn("A minimum HFile version of " + HFile.MIN_FORMAT_VERSION_WITH_TAGS
        + " is required to support cell attributes/tags. Consider setting "
        + HFile.FORMAT_VERSION_KEY + " accordingly.");
      WARN_CELL_WITH_TAGS = false;
    }
  }

  fsBlockWriter.write(cell);

  totalKeyLength += CellUtil.estimatedSerializedSizeOfKey(cell);
  totalValueLength += vlength;

  // Are we the first key in this block?
  if (firstCellInBlock == null) {
    // If cell is big, block will be closed and this firstCellInBlock reference will only last
    // a short while.
    firstCellInBlock = cell;
  }

  // TODO: What if cell is 10MB and we write infrequently?  We'll hold on to the cell here
  // indefinetly?
  lastCell = cell;
  entryCount++;
  this.maxMemstoreTS = Math.max(this.maxMemstoreTS, cell.getSequenceId());
}
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:51,代碼來源:HFileWriterV2.java


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