Search in sources :

Example 1 with VisitorFunction

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;
}
Also used : Authorizations(org.apache.accumulo.core.security.Authorizations) VisitorFunction(datawave.query.tables.async.event.VisitorFunction) Instance(org.apache.accumulo.core.client.Instance) InMemoryInstance(datawave.accumulo.inmemory.InMemoryInstance) ClientContext(org.apache.accumulo.core.client.impl.ClientContext) InMemoryInstance(datawave.accumulo.inmemory.InMemoryInstance) ParseException(org.apache.commons.jexl2.parser.ParseException) TableNotFoundException(org.apache.accumulo.core.client.TableNotFoundException) AccumuloSecurityException(org.apache.accumulo.core.client.AccumuloSecurityException) IOException(java.io.IOException) AccumuloException(org.apache.accumulo.core.client.AccumuloException) InMemoryTabletLocator(datawave.accumulo.inmemory.impl.InMemoryTabletLocator) TabletLocator(org.apache.accumulo.core.client.impl.TabletLocator) PasswordToken(org.apache.accumulo.core.client.security.tokens.PasswordToken) List(java.util.List) InMemoryTabletLocator(datawave.accumulo.inmemory.impl.InMemoryTabletLocator) Credentials(org.apache.accumulo.core.client.impl.Credentials)

Aggregations

InMemoryInstance (datawave.accumulo.inmemory.InMemoryInstance)1 InMemoryTabletLocator (datawave.accumulo.inmemory.impl.InMemoryTabletLocator)1 VisitorFunction (datawave.query.tables.async.event.VisitorFunction)1 IOException (java.io.IOException)1 List (java.util.List)1 AccumuloException (org.apache.accumulo.core.client.AccumuloException)1 AccumuloSecurityException (org.apache.accumulo.core.client.AccumuloSecurityException)1 Instance (org.apache.accumulo.core.client.Instance)1 TableNotFoundException (org.apache.accumulo.core.client.TableNotFoundException)1 ClientContext (org.apache.accumulo.core.client.impl.ClientContext)1 Credentials (org.apache.accumulo.core.client.impl.Credentials)1 TabletLocator (org.apache.accumulo.core.client.impl.TabletLocator)1 PasswordToken (org.apache.accumulo.core.client.security.tokens.PasswordToken)1 Authorizations (org.apache.accumulo.core.security.Authorizations)1 ParseException (org.apache.commons.jexl2.parser.ParseException)1