本文整理匯總了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;
}
示例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);
}