本文整理匯總了Java中org.apache.hadoop.hbase.client.Scan.getCaching方法的典型用法代碼示例。如果您正苦於以下問題:Java Scan.getCaching方法的具體用法?Java Scan.getCaching怎麽用?Java Scan.getCaching使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.apache.hadoop.hbase.client.Scan
的用法示例。
在下文中一共展示了Scan.getCaching方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: ParallelResultScanner
import org.apache.hadoop.hbase.client.Scan; //導入方法依賴的package包/類
public ParallelResultScanner(TableName tableName, HbaseAccessor hbaseAccessor,
ExecutorService executor, Scan originalScan,
AbstractRowKeyDistributor keyDistributor, int
numParallelThreads) throws IOException {
if (hbaseAccessor == null) {
throw new NullPointerException("hbaseAccessor must not be null");
}
if (executor == null) {
throw new NullPointerException("executor must not be null");
}
if (keyDistributor == null) {
throw new NullPointerException("keyDistributor must not be null");
}
if (originalScan == null) {
throw new NullPointerException("originalScan must not be null");
}
this.keyDistributor = keyDistributor;
final ScanTaskConfig scanTaskConfig = new ScanTaskConfig(tableName, hbaseAccessor,
keyDistributor, originalScan.getCaching());
final Scan[] splitScans = splitScans(originalScan);
this.scanTasks = createScanTasks(scanTaskConfig, splitScans, numParallelThreads);
this.nextResults = new Result[scanTasks.size()];
for (ScanTask scanTask : scanTasks) {
executor.execute(scanTask);
}
}
示例2: fromScan
import org.apache.hadoop.hbase.client.Scan; //導入方法依賴的package包/類
/**
* @param scan the scan specification
* @throws Exception
*/
public static ScannerModel fromScan(Scan scan) throws Exception {
ScannerModel model = new ScannerModel();
model.setStartRow(scan.getStartRow());
model.setEndRow(scan.getStopRow());
Map<byte [], NavigableSet<byte []>> families = scan.getFamilyMap();
if (families != null) {
for (Map.Entry<byte [], NavigableSet<byte []>> entry : families.entrySet()) {
if (entry.getValue() != null) {
for (byte[] qualifier: entry.getValue()) {
model.addColumn(Bytes.add(entry.getKey(), COLUMN_DIVIDER, qualifier));
}
} else {
model.addColumn(entry.getKey());
}
}
}
model.setStartTime(scan.getTimeRange().getMin());
model.setEndTime(scan.getTimeRange().getMax());
int caching = scan.getCaching();
if (caching > 0) {
model.setCaching(caching);
}
int batch = scan.getBatch();
if (batch > 0) {
model.setBatch(batch);
}
int maxVersions = scan.getMaxVersions();
if (maxVersions > 0) {
model.setMaxVersions(maxVersions);
}
Filter filter = scan.getFilter();
if (filter != null) {
model.setFilter(stringifyFilter(filter));
}
// Add the visbility labels if found in the attributes
Authorizations authorizations = scan.getAuthorizations();
if (authorizations != null) {
List<String> labels = authorizations.getLabels();
for (String label : labels) {
model.addLabel(label);
}
}
return model;
}