本文整理了Java中org.apache.accumulo.core.client.Connector.createBatchScanner()
方法的一些代码示例,展示了Connector.createBatchScanner()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Connector.createBatchScanner()
方法的具体详情如下:
包路径:org.apache.accumulo.core.client.Connector
类名称:Connector
方法名:createBatchScanner
[英]Factory method to create a BatchScanner connected to Accumulo.
[中]用于创建连接到Accumulo的Batch Scanner的工厂方法。
代码示例来源:origin: prestodb/presto
tasks.add(executor.submit(() -> {
BatchScanner scan = connector.createBatchScanner(indexTable, auths, 10);
scan.setRanges(constraintEntry.getValue());
代码示例来源:origin: prestodb/presto
scanner = connector.createBatchScanner(split.getFullTableName(), getScanAuthorizations(session, split, connector, username), 10);
scanner.setRanges(split.getRanges());
代码示例来源:origin: prestodb/presto
Text columnFamily = new Text(getIndexColumnFamily(anyKey.getFamily().getBytes(UTF_8), anyKey.getQualifier().getBytes(UTF_8)).array());
BatchScanner scanner = connector.createBatchScanner(metricsTable, anyKey.getAuths(), 10);
try {
scanner.setRanges(stream(keys).map(CacheKey::getRange).collect(Collectors.toList()));
代码示例来源:origin: prestodb/presto
/**
* Loads the cardinality for the given Range. Uses a BatchScanner and sums the cardinality for all values that encapsulate the Range.
*
* @param key Range to get the cardinality for
* @return The cardinality of the column, which would be zero if the value does not exist
*/
@Override
public Long load(CacheKey key)
throws Exception
{
LOG.debug("Loading a non-exact range from Accumulo: %s", key);
// Get metrics table name and the column family for the scanner
String metricsTable = getMetricsTableName(key.getSchema(), key.getTable());
Text columnFamily = new Text(getIndexColumnFamily(key.getFamily().getBytes(UTF_8), key.getQualifier().getBytes(UTF_8)).array());
// Create scanner for querying the range
BatchScanner scanner = connector.createBatchScanner(metricsTable, key.auths, 10);
scanner.setRanges(connector.tableOperations().splitRangeByTablets(metricsTable, key.range, Integer.MAX_VALUE));
scanner.fetchColumn(columnFamily, CARDINALITY_CQ_AS_TEXT);
try {
return stream(scanner)
.map(Entry::getValue)
.map(Value::toString)
.mapToLong(Long::parseLong)
.sum();
}
finally {
scanner.close();
}
}
代码示例来源:origin: NationalSecurityAgency/datawave
public BatchScanner createBatchScanner(Authorizations authorizations, int threads) throws TableNotFoundException {
return connector.createBatchScanner(TABLE_NAME, authorizations, threads);
}
}
代码示例来源:origin: org.apache.accumulo/accumulo-core
public static BatchScanner getBatchScanner(Connector conn, int queryThreads)
throws ReplicationTableOfflineException {
try {
return conn.createBatchScanner(NAME, Authorizations.EMPTY, queryThreads);
} catch (TableNotFoundException e) {
throw new AssertionError(NAME + " should exist, but doesn't.");
} catch (TableOfflineException e) {
throw new ReplicationTableOfflineException(e);
}
}
代码示例来源:origin: org.apache.rya/rya.indexing
public static BatchScanner createBatchScanner(final String tablename, final Configuration conf)
throws AccumuloException, AccumuloSecurityException, TableNotFoundException {
final Connector connector = ConfigUtils.getConnector(conf);
final Authorizations auths = ConfigUtils.getAuthorizations(conf);
Integer numThreads = null;
if (conf instanceof RdfCloudTripleStoreConfiguration) {
numThreads = ((RdfCloudTripleStoreConfiguration) conf).getNumThreads();
} else {
numThreads = conf.getInt(RdfCloudTripleStoreConfiguration.CONF_NUM_THREADS, 2);
}
return connector.createBatchScanner(tablename, auths, numThreads);
}
代码示例来源:origin: apache/incubator-rya
public static BatchScanner createBatchScanner(final String tablename, final Configuration conf)
throws AccumuloException, AccumuloSecurityException, TableNotFoundException {
final Connector connector = ConfigUtils.getConnector(conf);
final Authorizations auths = ConfigUtils.getAuthorizations(conf);
Integer numThreads = null;
if (conf instanceof RdfCloudTripleStoreConfiguration) {
numThreads = ((RdfCloudTripleStoreConfiguration) conf).getNumThreads();
} else {
numThreads = conf.getInt(RdfCloudTripleStoreConfiguration.CONF_NUM_THREADS, 2);
}
return connector.createBatchScanner(tablename, auths, numThreads);
}
代码示例来源:origin: org.apache.accumulo/accumulo-test
@Override
public Integer run() throws Exception {
Connector conn = mac.getConnector(rootUser.getPrincipal(), delegationToken);
BatchScanner bs = conn.createBatchScanner(tableName, Authorizations.EMPTY, 2);
bs.setRanges(Collections.singleton(new Range()));
int recordsSeen = Iterables.size(bs);
bs.close();
return recordsSeen;
}
});
代码示例来源:origin: org.vertexium/vertexium-accumulo
public ScannerBase createBatchScanner(
String tableName,
Collection<org.apache.accumulo.core.data.Range> ranges,
org.apache.accumulo.core.security.Authorizations accumuloAuthorizations
) throws TableNotFoundException {
ScannerBase scanner;
scanner = connector.createBatchScanner(tableName, accumuloAuthorizations, numberOfQueryThreads);
((BatchScanner) scanner).setRanges(ranges);
return scanner;
}
代码示例来源:origin: visallo/vertexium
public ScannerBase createBatchScanner(
String tableName,
Collection<org.apache.accumulo.core.data.Range> ranges,
org.apache.accumulo.core.security.Authorizations accumuloAuthorizations
) throws TableNotFoundException {
ScannerBase scanner;
scanner = connector.createBatchScanner(tableName, accumuloAuthorizations, numberOfQueryThreads);
((BatchScanner) scanner).setRanges(ranges);
return scanner;
}
代码示例来源:origin: org.calrissian.accumulorecipes/entity-store
public static void setQueryInfo(Job job, Set<String> entityTypes, Node query, EntityShardBuilder shardBuilder, TypeRegistry<String> typeRegistry) throws AccumuloSecurityException, AccumuloException, TableNotFoundException, IOException {
validateOptions(job);
Instance instance = getInstance(job);
Connector connector = instance.getConnector(getPrincipal(job), getAuthenticationToken(job));
BatchScanner scanner = connector.createBatchScanner(DEFAULT_IDX_TABLE_NAME, getScanAuthorizations(job), 5);
GlobalIndexVisitor globalIndexVisitor = new EntityGlobalIndexVisitor(scanner, shardBuilder, entityTypes);
configureScanner(job, query, globalIndexVisitor, typeRegistry);
job.getConfiguration().setBoolean(QUERY, true);
job.getConfiguration().set(TYPE_REGISTRY, new String(toBase64(typeRegistry)));
}
代码示例来源:origin: org.calrissian.mango/mango-accumulo
/**
* On creation of a batchscanner, if there are > 0 threads available in the pool, return a BatchScanner. Otherwise, return
* the {@link BatchScannerWithScanners}, a BatchScanner backed by Scanners.
*/
@Override
public BatchScanner createBatchScanner(String tableName, Authorizations authorizations, int numQueryThreads) throws TableNotFoundException {
numQueryThreads = allocateNumThreads(numQueryThreads);
if (numQueryThreads > 0) {
return new BatchScannerThreadedResource(wrapped.createBatchScanner(tableName, authorizations, numQueryThreads),
this, numQueryThreads);
} else {
return new BatchScannerWithScanners(this, tableName, authorizations);
}
}
代码示例来源:origin: org.neolumin.vertexium/vertexium-accumulo
private BatchScanner createElementBatchScanner(EnumSet<FetchHint> fetchHints, Authorizations authorizations, ElementType elementType, int numQueryThreads) {
try {
String tableName = getTableNameFromElementType(elementType);
BatchScanner scanner = connector.createBatchScanner(tableName, toAccumuloAuthorizations(authorizations), numQueryThreads);
applyFetchHints(scanner, fetchHints, elementType);
return scanner;
} catch (TableNotFoundException e) {
throw new VertexiumException(e);
}
}
代码示例来源:origin: lumifyio/securegraph
private BatchScanner createElementBatchScanner(EnumSet<FetchHint> fetchHints, Authorizations authorizations, ElementType elementType, int numQueryThreads) {
try {
String tableName = getTableNameFromElementType(elementType);
BatchScanner scanner = connector.createBatchScanner(tableName, toAccumuloAuthorizations(authorizations), numQueryThreads);
applyFetchHints(scanner, fetchHints, elementType);
return scanner;
} catch (TableNotFoundException e) {
throw new SecureGraphException(e);
}
}
代码示例来源:origin: org.apache.accumulo/accumulo-server
public MetaDataTableScanner(Instance instance, TCredentials auths, Range range, CurrentState state) {
// scan over metadata table, looking for tablets in the wrong state based on the live servers and online tables
try {
Connector connector = instance.getConnector(auths.getPrincipal(), CredentialHelper.extractToken(auths));
mdScanner = connector.createBatchScanner(Constants.METADATA_TABLE_NAME, Constants.NO_AUTHS, 8);
configureScanner(mdScanner, state);
mdScanner.setRanges(Collections.singletonList(range));
iter = mdScanner.iterator();
} catch (Exception ex) {
mdScanner.close();
throw new RuntimeException(ex);
}
}
代码示例来源:origin: edu.jhuapl.tinkerpop/blueprints-accumulo-graph
protected BatchScanner getBatchScanner() {
try {
BatchScanner scanner = globals.getConfig().getConnector().createBatchScanner(tableName,
globals.getConfig().getAuthorizations(), globals.getConfig().getQueryThreads());
scanner.setRanges(Collections.singletonList(new Range()));
return scanner;
} catch (Exception e) {
throw new AccumuloGraphException(e);
}
}
代码示例来源:origin: JHUAPL/AccumuloGraph
protected BatchScanner getBatchScanner() {
try {
BatchScanner scanner = globals.getConfig().getConnector().createBatchScanner(tableName,
globals.getConfig().getAuthorizations(), globals.getConfig().getQueryThreads());
scanner.setRanges(Collections.singletonList(new Range()));
return scanner;
} catch (Exception e) {
throw new AccumuloGraphException(e);
}
}
代码示例来源:origin: org.apache.accumulo/accumulo-test
private void verify(Connector c, String tableName, ByteArraySet nss, String... expected)
throws Exception {
Scanner scanner = c.createScanner(tableName, new Authorizations(nss));
verify(scanner.iterator(), expected);
BatchScanner bs = getConnector().createBatchScanner(tableName, new Authorizations(nss), 3);
bs.setRanges(Collections.singleton(new Range()));
verify(bs.iterator(), expected);
bs.close();
}
代码示例来源:origin: locationtech/geowave
public OsmProvider(final OSMIngestCommandArgs args, final AccumuloRequiredOptions store)
throws AccumuloSecurityException, AccumuloException, TableNotFoundException {
conn =
new ZooKeeperInstance(store.getInstance(), store.getZookeeper()).getConnector(
store.getUser(),
new PasswordToken(store.getPassword()));
bs =
conn.createBatchScanner(
args.getQualifiedTableName(),
new Authorizations(args.getVisibilityOptions().getVisibility()),
1);
}
内容来源于网络,如有侵权,请联系作者删除!