本文整理汇总了Java中org.apache.hadoop.hbase.regionserver.RegionScanner.nextRaw方法的典型用法代码示例。如果您正苦于以下问题:Java RegionScanner.nextRaw方法的具体用法?Java RegionScanner.nextRaw怎么用?Java RegionScanner.nextRaw使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.hadoop.hbase.regionserver.RegionScanner
的用法示例。
在下文中一共展示了RegionScanner.nextRaw方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: init
import org.apache.hadoop.hbase.regionserver.RegionScanner; //导入方法依赖的package包/类
private ArrayList<Cell> init(RegionScanner regionScanner, ScanRange primaryRange,
IndexPutParser parse) throws IOException {
ArrayList<Cell> ret = new ArrayList<>();
while (true) {
List<Cell> oneRow = new ArrayList<>();
if (!regionScanner.nextRaw(oneRow)) break;
processOneRow(ret, oneRow, parse);
// processOneRow(ret, oneRow, primaryRange, relation);
}
Collections.sort(ret, KeyValue.COMPARATOR);
return ret;
}
示例2: InnerScannerAsIterator
import org.apache.hadoop.hbase.regionserver.RegionScanner; //导入方法依赖的package包/类
public InnerScannerAsIterator(RegionScanner regionScanner) {
this.regionScanner = regionScanner;
try {
hasMore = regionScanner.nextRaw(nextOne);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
示例3: buildAggrCache
import org.apache.hadoop.hbase.regionserver.RegionScanner; //导入方法依赖的package包/类
@SuppressWarnings("rawtypes")
ObserverAggregationCache buildAggrCache(final RegionScanner innerScanner, CoprocessorRowType type, CoprocessorProjector projector, ObserverAggregators aggregators, CoprocessorFilter filter, Stats stats) throws IOException {
ObserverAggregationCache aggCache = new ObserverAggregationCache(aggregators);
ObserverTuple tuple = new ObserverTuple(type);
boolean hasMore = true;
List<Cell> results = new ArrayList<Cell>();
while (hasMore) {
results.clear();
hasMore = innerScanner.nextRaw(results);
if (results.isEmpty())
continue;
if (stats != null)
stats.countInputRow(results);
Cell cell = results.get(0);
tuple.setUnderlying(cell.getRowArray(), cell.getRowOffset(), cell.getRowLength());
if (filter != null && filter.evaluate(tuple) == false)
continue;
CoprocessorProjector.AggrKey aggKey = projector.getAggrKey(results);
MeasureAggregator[] bufs = aggCache.getBuffer(aggKey);
aggregators.aggregate(bufs, results);
aggCache.checkMemoryUsage();
}
return aggCache;
}
示例4: processData
import org.apache.hadoop.hbase.regionserver.RegionScanner; //导入方法依赖的package包/类
private static ExportProtos.ExportResponse processData(final Region region, final Configuration conf,
final UserProvider userProvider, final Scan scan, final Token userToken,
final List<SequenceFile.Writer.Option> opts) throws IOException {
ScanCoprocessor cp = new ScanCoprocessor(region);
RegionScanner scanner = null;
try (RegionOp regionOp = new RegionOp(region);
SecureWriter out = new SecureWriter(conf, userProvider, userToken, opts)) {
scanner = cp.checkScannerOpen(scan);
ImmutableBytesWritable key = new ImmutableBytesWritable();
long rowCount = 0;
long cellCount = 0;
List<Result> results = new ArrayList<>();
List<Cell> cells = new ArrayList<>();
boolean hasMore;
do {
boolean bypass = cp.preScannerNext(scanner, results, scan.getBatch());
if (bypass) {
hasMore = false;
} else {
hasMore = scanner.nextRaw(cells);
if (cells.isEmpty()) {
continue;
}
Cell firstCell = cells.get(0);
for (Cell cell : cells) {
if (Bytes.compareTo(firstCell.getRowArray(), firstCell.getRowOffset(), firstCell.getRowLength(),
cell.getRowArray(), cell.getRowOffset(), cell.getRowLength()) != 0) {
throw new IOException("Why the RegionScanner#nextRaw returns the data of different rows??"
+ " first row=" + Bytes.toHex(firstCell.getRowArray(), firstCell.getRowOffset(), firstCell.getRowLength())
+ ", current row=" + Bytes.toHex(cell.getRowArray(), cell.getRowOffset(), cell.getRowLength()));
}
}
results.add(Result.create(cells));
cells.clear();
cp.postScannerNext(scanner, results, scan.getBatch(), hasMore);
}
for (Result r : results) {
key.set(r.getRow());
out.append(key, r);
++rowCount;
cellCount += r.size();
}
results.clear();
} while (hasMore);
return ExportProtos.ExportResponse.newBuilder()
.setRowCount(rowCount)
.setCellCount(cellCount)
.build();
} finally {
cp.checkScannerClose(scanner);
}
}