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


Java Result.createCompleteResult方法代码示例

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


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

示例1: testExceptionThrownOnMismatchedPartialResults

import org.apache.hadoop.hbase.client.Result; //导入方法依赖的package包/类
/**
 * When reconstructing the complete result from its partials we ensure that the row of each
 * partial result is the same. If one of the rows differs, an exception is thrown.
 */
@Test
public void testExceptionThrownOnMismatchedPartialResults() throws IOException {
  assertTrue(NUM_ROWS >= 2);

  ArrayList<Result> partials = new ArrayList<>();
  Scan scan = new Scan();
  scan.setMaxResultSize(Long.MAX_VALUE);
  ResultScanner scanner = TABLE.getScanner(scan);
  Result r1 = scanner.next();
  partials.add(r1);
  Result r2 = scanner.next();
  partials.add(r2);

  assertFalse(Bytes.equals(r1.getRow(), r2.getRow()));

  try {
    Result.createCompleteResult(partials);
    fail("r1 and r2 are from different rows. It should not be possible to combine them into"
        + " a single result");
  } catch (IOException e) {
  }

  scanner.close();
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:29,代码来源:TestPartialResultsFromClientSide.java

示例2: testPartialResultsReassembly

import org.apache.hadoop.hbase.client.Result; //导入方法依赖的package包/类
public void testPartialResultsReassembly(Scan scanBase) throws Exception {
  Scan partialScan = new Scan(scanBase);
  partialScan.setMaxResultSize(1);
  partialScan.setAllowPartialResults(true);
  ResultScanner partialScanner = TABLE.getScanner(partialScan);

  Scan oneShotScan = new Scan(scanBase);
  oneShotScan.setMaxResultSize(Long.MAX_VALUE);
  ResultScanner oneShotScanner = TABLE.getScanner(oneShotScan);

  ArrayList<Result> partials = new ArrayList<>();
  for (int i = 0; i < NUM_ROWS; i++) {
    Result partialResult = null;
    Result completeResult = null;
    Result oneShotResult = null;
    partials.clear();

    do {
      partialResult = partialScanner.next();
      partials.add(partialResult);
    } while (partialResult != null && partialResult.isPartial());

    completeResult = Result.createCompleteResult(partials);
    oneShotResult = oneShotScanner.next();

    compareResults(completeResult, oneShotResult, null);
  }

  assertTrue(oneShotScanner.next() == null);
  assertTrue(partialScanner.next() == null);

  oneShotScanner.close();
  partialScanner.close();
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:35,代码来源:TestPartialResultsFromClientSide.java


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