use of org.apache.commons.jexl2.parser.ASTDelayedPredicate in project datawave by NationalSecurityAgency.
the class IndexInfoTest method testUnion_OneTermIsDelayedPredicate.
/**
* Union of query terms when one term is a delayed predicate
*/
@Test
public void testUnion_OneTermIsDelayedPredicate() {
ASTDelayedPredicate delayedPredicate = ASTDelayedPredicate.create(JexlNodeFactory.buildEQNode("FIELD", "VALUE"));
IndexInfo left = new IndexInfo(50);
left.applyNode(delayedPredicate);
List<IndexMatch> rightMatches = buildIndexMatches("FIELD", "VALUE", "doc1", "doc2", "doc3");
IndexInfo right = new IndexInfo(rightMatches);
right.applyNode(JexlNodeFactory.buildEQNode("FIELD", "VALUE"));
IndexInfo merged = right.union(left);
assertEquals(0, merged.uids().size());
assertEquals("Count should be 53 but is " + merged.count(), 53, merged.count());
String expectedQuery = "((_Delayed_ = true) && (FIELD == 'VALUE'))";
String actualQuery = JexlStringBuildingVisitor.buildQuery(merged.getNode());
assertEquals(expectedQuery, actualQuery);
}
Aggregations