當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。