Search in sources :

Example 1 with IndexFilterIteratorBuilder

use of datawave.query.iterator.builder.IndexFilterIteratorBuilder in project datawave by NationalSecurityAgency.

the class IteratorBuildingVisitor method ivarateFilter.

/**
 * Build the iterator stack using the filter ivarator (field index caching filter iterator)
 *
 * @param rootNode
 *            the node that was processed to generated this builder
 * @param sourceNode
 *            the source node derived from the root
 * @param data
 */
public void ivarateFilter(JexlNode rootNode, JexlNode sourceNode, Object data, List<ASTFunctionNode> functionNodes) throws IOException {
    IndexFilterIteratorBuilder builder = new IndexFilterIteratorBuilder();
    builder.negateAsNeeded(data);
    // hence the "IndexAgnostic" method can be used here
    if (sourceNode instanceof ASTAndNode) {
        LiteralRange range = JexlASTHelper.findRange().recursively().getRange(sourceNode);
        if (range == null) {
            QueryException qe = new QueryException(DatawaveErrorCode.MULTIPLE_RANGES_IN_EXPRESSION);
            throw new DatawaveFatalQueryException(qe);
        }
        builder.setRangeAndFunction(range, new FunctionFilter(functionNodes));
    } else {
        QueryException qe = new QueryException(DatawaveErrorCode.UNEXPECTED_SOURCE_NODE, MessageFormat.format("{0}", "ASTFunctionNode"));
        throw new DatawaveFatalQueryException(qe);
    }
    ivarate(builder, rootNode, sourceNode, data);
}
Also used : DatawaveFatalQueryException(datawave.query.exceptions.DatawaveFatalQueryException) QueryException(datawave.webservice.query.exception.QueryException) IndexFilterIteratorBuilder(datawave.query.iterator.builder.IndexFilterIteratorBuilder) DatawaveFatalQueryException(datawave.query.exceptions.DatawaveFatalQueryException) LiteralRange(datawave.query.jexl.LiteralRange) ASTAndNode(org.apache.commons.jexl2.parser.ASTAndNode)

Aggregations

DatawaveFatalQueryException (datawave.query.exceptions.DatawaveFatalQueryException)1 IndexFilterIteratorBuilder (datawave.query.iterator.builder.IndexFilterIteratorBuilder)1 LiteralRange (datawave.query.jexl.LiteralRange)1 QueryException (datawave.webservice.query.exception.QueryException)1 ASTAndNode (org.apache.commons.jexl2.parser.ASTAndNode)1