use of datawave.query.tables.async.event.VisitorFunction in project datawave by NationalSecurityAgency.
the class PushdownScheduler method concatIterators.
/**
* @return
* @throws ParseException
* @throws TableNotFoundException
* @throws AccumuloSecurityException
* @throws AccumuloException
*/
protected Iterator<Entry<Key, Value>> concatIterators() throws AccumuloException, AccumuloSecurityException, TableNotFoundException, ParseException {
String tableName = config.getShardTableName();
Set<Authorizations> auths = config.getAuthorizations();
TabletLocator tl;
Instance instance = config.getConnector().getInstance();
if (instance instanceof InMemoryInstance) {
tl = new InMemoryTabletLocator();
tableId = config.getTableName();
} else {
tableId = Tables.getTableId(instance, tableName);
Credentials credentials = new Credentials(config.getConnector().whoami(), new PasswordToken(config.getAccumuloPassword()));
tl = TabletLocator.getLocator(new ClientContext(instance, credentials, AccumuloConfiguration.getDefaultConfiguration()), tableId);
}
Iterator<List<ScannerChunk>> chunkIter = Iterators.transform(getQueryDataIterator(), new PushdownFunction(tl, config, settings, tableId));
try {
session = scannerFactory.newQueryScanner(tableName, auths, config.getQuery());
if (config.getBypassAccumulo()) {
session.setDelegatedInitializer(RfileResource.class);
}
if (config.getSpeculativeScanning()) {
session.setSpeculativeScanning(true);
}
session.addVisitor(new VisitorFunction(config, metadataHelper));
} catch (Exception e) {
throw new RuntimeException(e);
}
session.setScanLimit(config.getMaxDocScanTimeout());
if (config.getBackoffEnabled()) {
session.setBackoffEnabled(true);
}
session.setChunkIter(chunkIter);
session.setTabletLocator(tl);
session.updateIdentifier(config.getQuery().getId().toString());
return session;
}
Aggregations