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


Java HTableInterface.getScanner方法代码示例

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


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

示例1: QueryAll

import org.apache.hadoop.hbase.client.HTableInterface; //导入方法依赖的package包/类
public static void QueryAll(String tableName) {
    try {
        HTableInterface table = conn.getTable(tableName);

        ResultScanner rs = table.getScanner(new Scan());
        for (Result r : rs) {
            System.out.println("rowkey:" + new String(r.getRow()));
            for (KeyValue keyValue : r.raw()) {
                System.out.println("column:" + new String(keyValue.getFamily())
                        + "====value:" + new String(keyValue.getValue()));
            }
        }
        table.close();
    } catch (IOException e) {
        e.printStackTrace();
    }
}
 
开发者ID:yjp123456,项目名称:SparkDemo,代码行数:18,代码来源:MyClass.java

示例2: verifyScan

import org.apache.hadoop.hbase.client.HTableInterface; //导入方法依赖的package包/类
private void verifyScan(HTableInterface table, Scan scan, List<KeyValue> expectedCells) throws Exception {
  List<Cell> actualCells = new ArrayList<>();
  try (ResultScanner scanner = table.getScanner(scan)) {
    Result[] results = scanner.next(expectedCells.size() + 1);
    for (Result result : results) {
      actualCells.addAll(Lists.newArrayList(result.rawCells()));
    }
    Assert.assertEquals(expectedCells, actualCells);
  }
}
 
开发者ID:apache,项目名称:incubator-tephra,代码行数:11,代码来源:TransactionAwareHTableTest.java

示例3: getNextSetOfTimeRegions

import org.apache.hadoop.hbase.client.HTableInterface; //导入方法依赖的package包/类
@Nullable
private TimeRegions getNextSetOfTimeRegions(HTableInterface stateTable, long time) throws IOException {
  byte[] timeBytes = Bytes.toBytes(getInvertedTime(time));
  Scan scan = new Scan(makeTimeRegionKey(timeBytes, EMPTY_BYTE_ARRAY), REGION_TIME_KEY_PREFIX_STOP);
  scan.addColumn(FAMILY, REGION_TIME_COL);


  long currentRegionTime = -1;
  SortedSet<byte[]> regions = new TreeSet<>(Bytes.BYTES_COMPARATOR);
  Result next;
  try (ResultScanner scanner = stateTable.getScanner(scan)) {
    while ((next = scanner.next()) != null) {
      Map.Entry<Long, byte[]> timeRegion = getTimeRegion(next.getRow());
      // Stop if reached next time value
      if (currentRegionTime == -1) {
        currentRegionTime = timeRegion.getKey();
      } else if (timeRegion.getKey() < currentRegionTime) {
        break;
      } else if (timeRegion.getKey() > currentRegionTime) {
        throw new IllegalStateException(
          String.format("Got out of order time %d when expecting time less than or equal to %d",
                        timeRegion.getKey(), currentRegionTime));
      }
      regions.add(timeRegion.getValue());
    }
  }
  return regions.isEmpty() ? null : new TimeRegions(currentRegionTime, Collections.unmodifiableSortedSet(regions));
}
 
开发者ID:apache,项目名称:incubator-tephra,代码行数:29,代码来源:DataJanitorState.java

示例4: deleteFromScan

import org.apache.hadoop.hbase.client.HTableInterface; //导入方法依赖的package包/类
@VisibleForTesting
void deleteFromScan(HTableInterface stateTable, Scan scan) throws IOException {
  try (ResultScanner scanner = stateTable.getScanner(scan)) {
    Result next;
    while ((next = scanner.next()) != null) {
      stateTable.delete(new Delete(next.getRow()));
    }
  }
}
 
开发者ID:apache,项目名称:incubator-tephra,代码行数:10,代码来源:DataJanitorState.java


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