当前位置: 首页>>代码示例>>Java>>正文


Java Cell.getRowArray方法代码示例

本文整理汇总了Java中org.apache.hadoop.hbase.Cell.getRowArray方法的典型用法代码示例。如果您正苦于以下问题:Java Cell.getRowArray方法的具体用法?Java Cell.getRowArray怎么用?Java Cell.getRowArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.hadoop.hbase.Cell的用法示例。


在下文中一共展示了Cell.getRowArray方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: resetScannerStack

import org.apache.hadoop.hbase.Cell; //导入方法依赖的package包/类
protected void resetScannerStack(Cell lastTopKey) throws IOException {
  if (heap != null) {
    throw new RuntimeException("StoreScanner.reseek run on an existing heap!");
  }

  /* When we have the scan object, should we not pass it to getScanners()
   * to get a limited set of scanners? We did so in the constructor and we
   * could have done it now by storing the scan object from the constructor */
  List<KeyValueScanner> scanners = getScannersNoCompaction();

  // Seek all scanners to the initial key
  seekScanners(scanners, lastTopKey, false, parallelSeekEnabled);

  // Combine all seeked scanners with a heap
  resetKVHeap(scanners, store.getComparator());

  // Reset the state of the Query Matcher and set to top row.
  // Only reset and call setRow if the row changes; avoids confusing the
  // query matcher if scanning intra-row.
  Cell kv = heap.peek();
  if (kv == null) {
    kv = lastTopKey;
  }
  byte[] row = kv.getRowArray();
  int offset = kv.getRowOffset();
  short length = kv.getRowLength();
  if ((matcher.row == null) || !Bytes
      .equals(row, offset, length, matcher.row, matcher.rowOffset, matcher.rowLength)) {
    this.countPerRow = 0;
    matcher.reset();
    matcher.setRow(row, offset, length);
  }
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:34,代码来源:StoreScanner.java

示例2: 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

示例3: appendGeneralBloomfilter

import org.apache.hadoop.hbase.Cell; //导入方法依赖的package包/类
private void appendGeneralBloomfilter(final Cell cell) throws IOException {
  if (this.generalBloomFilterWriter != null) {
    // only add to the bloom filter on a new, unique key
    boolean newKey = true;
    if (this.lastCell != null) {
      switch (bloomType) {
      case ROW:
        newKey = !kvComparator.matchingRows(cell, lastCell);
        break;
      case ROWCOL:
        newKey = !kvComparator.matchingRowColumn(cell, lastCell);
        break;
      case NONE:
        newKey = false;
        break;
      default:
        throw new IOException(
            "Invalid Bloom filter type: " + bloomType + " (ROW or ROWCOL expected)");
      }
    }
    if (newKey) {
      /*
       * http://2.bp.blogspot.com/_Cib_A77V54U/StZMrzaKufI/AAAAAAAAADo/ZhK7bGoJdMQ/s400/KeyValue.
       * png Key = RowLen + Row + FamilyLen + Column [Family + Qualifier] + TimeStamp 2 Types of
       * Filtering: 1. Row = Row 2. RowCol = Row + Qualifier
       */
      byte[] bloomKey;
      int bloomKeyOffset, bloomKeyLen;

      switch (bloomType) {
      case ROW:
        bloomKey = cell.getRowArray();
        bloomKeyOffset = cell.getRowOffset();
        bloomKeyLen = cell.getRowLength();
        break;
      case ROWCOL:
        // merge(row, qualifier)
        // TODO: could save one buffer copy in case of compound Bloom
        // filters when this involves creating a KeyValue
        bloomKey = generalBloomFilterWriter
            .createBloomKey(cell.getRowArray(), cell.getRowOffset(), cell.getRowLength(),
                cell.getQualifierArray(), cell.getQualifierOffset(), cell.getQualifierLength());
        bloomKeyOffset = 0;
        bloomKeyLen = bloomKey.length;
        break;
      default:
        throw new IOException(
            "Invalid Bloom filter type: " + bloomType + " (ROW or ROWCOL expected)");
      }
      generalBloomFilterWriter.add(bloomKey, bloomKeyOffset, bloomKeyLen);
      if (lastBloomKey != null && generalBloomFilterWriter.getComparator()
          .compareFlatKey(bloomKey, bloomKeyOffset, bloomKeyLen, lastBloomKey,
              lastBloomKeyOffset, lastBloomKeyLen) <= 0) {
        throw new IOException("Non-increasing Bloom keys: " + Bytes
            .toStringBinary(bloomKey, bloomKeyOffset, bloomKeyLen) + " after " + Bytes
            .toStringBinary(lastBloomKey, lastBloomKeyOffset, lastBloomKeyLen));
      }
      lastBloomKey = bloomKey;
      lastBloomKeyOffset = bloomKeyOffset;
      lastBloomKeyLen = bloomKeyLen;
      this.lastCell = cell;
    }
  }
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:65,代码来源:StoreFile.java


注:本文中的org.apache.hadoop.hbase.Cell.getRowArray方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。