Search in sources :

Example 16 with DatawaveQueryException

use of datawave.query.exceptions.DatawaveQueryException in project datawave by NationalSecurityAgency.

the class IndexQueryPlanner method getQueryIterator.

@Override
public IteratorSetting getQueryIterator(MetadataHelper metadataHelper, ShardQueryConfiguration config, Query settings, String queryString, Boolean isFullTable) throws DatawaveQueryException {
    if (isFullTable) {
        QueryException qe = new QueryException(DatawaveErrorCode.FULL_TABLE_SCAN_DISALLOWED);
        throw new FullTableScansDisallowedException(qe);
    }
    IteratorSetting cfg = super.getQueryIterator(metadataHelper, config, settings, queryString, isFullTable);
    if (null == cfg) {
        try {
            cfg = settingFuture.get();
        } catch (InterruptedException | ExecutionException e) {
            throw new RuntimeException(e);
        }
    }
    cfg.setIteratorClass(FieldIndexOnlyQueryIterator.class.getName());
    return cfg;
}
Also used : FieldIndexOnlyQueryIterator(datawave.query.iterator.FieldIndexOnlyQueryIterator) QueryException(datawave.webservice.query.exception.QueryException) DatawaveQueryException(datawave.query.exceptions.DatawaveQueryException) FullTableScansDisallowedException(datawave.query.exceptions.FullTableScansDisallowedException) IteratorSetting(org.apache.accumulo.core.client.IteratorSetting) ExecutionException(java.util.concurrent.ExecutionException)

Example 17 with DatawaveQueryException

use of datawave.query.exceptions.DatawaveQueryException in project datawave by NationalSecurityAgency.

the class TimedVisitorManager method timedVisit.

/**
 * Wrap visitor execution with a timer and debug msg
 *
 * @param timers
 *            a {@link QueryStopwatch}
 * @param stageName
 *            the name for this operation, for example "Fix Not Null Intent" or "Expand Regex Nodes"
 * @param visitorManager
 *            an interface that allows us to pass a lambda operation {@link VisitorManager}
 * @return the query tree, a {@link ASTJexlScript}
 * @throws DatawaveQueryException
 *             if something goes wrong
 */
public ASTJexlScript timedVisit(QueryStopwatch timers, String stageName, VisitorManager visitorManager) throws DatawaveQueryException {
    ASTJexlScript script;
    TraceStopwatch stopwatch = timers.newStartedStopwatch("DefaultQueryPlanner - " + stageName);
    try {
        script = visitorManager.apply();
        if (isDebugEnabled) {
            logQuery(script, "Query after visit: " + stageName);
        }
        if (validateAst) {
            try {
                ASTValidator.isValid(script, stageName);
            } catch (InvalidQueryTreeException e) {
                throw new DatawaveQueryException(e);
            }
        }
    } finally {
        stopwatch.stop();
    }
    return script;
}
Also used : InvalidQueryTreeException(datawave.query.exceptions.InvalidQueryTreeException) DatawaveQueryException(datawave.query.exceptions.DatawaveQueryException) ASTJexlScript(org.apache.commons.jexl2.parser.ASTJexlScript) TraceStopwatch(datawave.util.time.TraceStopwatch)

Aggregations

DatawaveQueryException (datawave.query.exceptions.DatawaveQueryException)17 QueryException (datawave.webservice.query.exception.QueryException)11 InvalidQueryException (datawave.query.exceptions.InvalidQueryException)10 BadRequestQueryException (datawave.webservice.query.exception.BadRequestQueryException)10 TableNotFoundException (org.apache.accumulo.core.client.TableNotFoundException)10 DatawaveFatalQueryException (datawave.query.exceptions.DatawaveFatalQueryException)9 DoNotPerformOptimizedQueryException (datawave.query.exceptions.DoNotPerformOptimizedQueryException)9 NotFoundQueryException (datawave.webservice.query.exception.NotFoundQueryException)9 PreConditionFailedQueryException (datawave.webservice.query.exception.PreConditionFailedQueryException)9 TraceStopwatch (datawave.util.time.TraceStopwatch)7 FullTableScansDisallowedException (datawave.query.exceptions.FullTableScansDisallowedException)6 IteratorSetting (org.apache.accumulo.core.client.IteratorSetting)5 NoResultsException (datawave.query.exceptions.NoResultsException)4 CannotExpandUnfieldedTermFatalException (datawave.query.exceptions.CannotExpandUnfieldedTermFatalException)3 EmptyUnfieldedTermExpansionException (datawave.query.exceptions.EmptyUnfieldedTermExpansionException)3 IOException (java.io.IOException)3 ExecutionException (java.util.concurrent.ExecutionException)3 AbstractGeometryType (datawave.data.type.AbstractGeometryType)2 Type (datawave.data.type.Type)2 InvocationTargetException (java.lang.reflect.InvocationTargetException)2