本文整理汇总了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();
}
}
示例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);
}
}
示例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));
}
示例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()));
}
}
}