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


Java Cell.equals方法代碼示例

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


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

示例1: transformCell

import org.apache.hadoop.hbase.Cell; //導入方法依賴的package包/類
@Override
public Cell transformCell(Cell v) throws IOException {
  // transformCell() is expected to follow an inclusive filterKeyValue() immediately:
  if (!v.equals(this.referenceKV)) {
    throw new IllegalStateException("Reference Cell: " + this.referenceKV + " does not match: "
        + v);
  }
  return this.transformedKV;
}
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:10,代碼來源:FilterList.java

示例2: runTest

import org.apache.hadoop.hbase.Cell; //導入方法依賴的package包/類
private void runTest(Path path, DataBlockEncoding blockEncoding,
    List<Cell> seeks) throws IOException {
  // read all of the key values
  StoreFile storeFile = new StoreFile(testingUtility.getTestFileSystem(),
    path, configuration, cacheConf, BloomType.NONE);

  long totalSize = 0;

  StoreFile.Reader reader = storeFile.createReader();
  StoreFileScanner scanner = reader.getStoreFileScanner(true, false);

  long startReadingTime = System.nanoTime();
  Cell current;
  scanner.seek(KeyValue.LOWESTKEY);
  while (null != (current = scanner.next())) { // just iterate it!
    if (KeyValueUtil.ensureKeyValue(current).getLength() < 0) {
      throw new IOException("Negative KV size: " + current);
    }
    totalSize += KeyValueUtil.ensureKeyValue(current).getLength();
  }
  long finishReadingTime = System.nanoTime();

  // do seeks
  long startSeeksTime = System.nanoTime();
  for (Cell keyValue : seeks) {
    scanner.seek(keyValue);
    Cell toVerify = scanner.next();
    if (!keyValue.equals(toVerify)) {
      System.out.println(String.format("KeyValue doesn't match:\n" + "Orig key: %s\n"
          + "Ret key:  %s", KeyValueUtil.ensureKeyValue(keyValue).getKeyString(), KeyValueUtil
          .ensureKeyValue(toVerify).getKeyString()));
      break;
    }
  }
  long finishSeeksTime = System.nanoTime();
  if (finishSeeksTime < startSeeksTime) {
    throw new AssertionError("Finish time " + finishSeeksTime +
        " is earlier than start time " + startSeeksTime);
  }

  // write some stats
  double readInMbPerSec = (totalSize * NANOSEC_IN_SEC) /
      (BYTES_IN_MEGABYTES * (finishReadingTime - startReadingTime));
  double seeksPerSec = (seeks.size() * NANOSEC_IN_SEC) /
      (finishSeeksTime - startSeeksTime);

  storeFile.closeReader(cacheConf.shouldEvictOnClose());
  clearBlockCache();

  System.out.println(blockEncoding);
  System.out.printf("  Read speed:       %8.2f (MB/s)\n", readInMbPerSec);
  System.out.printf("  Seeks per second: %8.2f (#/s)\n", seeksPerSec);
  System.out.printf("  Total KV size:    %d\n", totalSize);
}
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:55,代碼來源:EncodedSeekPerformanceTest.java


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