@Override public Object visit(ASTReference node, Object o) { // Recurse only if not delayed if (!ASTDelayedPredicate.instanceOf(node)) { super.visit(node, o); } else { isQueryFullySatisfied = false; } return null; }
@Override public Object visit(ASTReference node, Object o) { // Recurse only if not delayed or evaluation only if (!ASTDelayedPredicate.instanceOf(node) && !ASTEvaluationOnly.instanceOf(node)) { super.visit(node, o); } else if (ASTDelayedPredicate.instanceOf(node)) { JexlNode subNode = ASTDelayedPredicate.getQueryPropertySource(node, ASTDelayedPredicate.class); if (subNode instanceof ASTEQNode) { delayedEqNodes.add(subNode); } if (isQueryFullySatisfied == true) { log.warn("Determined that isQueryFullySatisfied should be false, but it was not preset to false in the SatisfactionVisitor"); } log.warn("Will not process ASTDelayedPredicate."); } return null; }
@Override public Object visit(ASTReference node, Object data) { // if a delayed predicate, then leave it alone if (ASTDelayedPredicate.instanceOf(node)) { return node; } else if (!ExecutableDeterminationVisitor.isExecutable(node, config, indexedFields, indexOnlyFields, nonEventFields, false, null, helper)) { super.visit(node, data); } return node; }
protected boolean isDelayed(JexlNode testNode) { if (ASTDelayedPredicate.instanceOf(testNode)) { return true; // We do not consider the index hole marker delayed as that is only a hole in the global index, not the field index // } else if (IndexHoleMarkerJexlNode.instanceOf(testNode)) { // return true; } else if (ExceededValueThresholdMarkerJexlNode.instanceOf(testNode)) { return true; } else if (ExceededTermThresholdMarkerJexlNode.instanceOf(testNode)) { return true; } else { return false; } }
protected boolean isDelayed(JexlNode testNode) { if (ASTDelayedPredicate.instanceOf(testNode)) { return true; } else if (IndexHoleMarkerJexlNode.instanceOf(testNode)) { return true; } else if (ExceededValueThresholdMarkerJexlNode.instanceOf(testNode)) { return true; } else if (ExceededTermThresholdMarkerJexlNode.instanceOf(testNode)) { return true; } else { return false; } }
@Override public Object visit(ASTAndNode node, Object data) { Set<JexlNode> markedParents = (data != null && data instanceof Set) ? (Set) data : null; // check to see if this is a delayed node already if (ExceededValueThresholdMarkerJexlNode.instanceOf(node) || ExceededOrThresholdMarkerJexlNode.instanceOf(node) || ASTDelayedPredicate.instanceOf(node) || IndexHoleMarkerJexlNode.instanceOf(node) || ASTEvaluationOnly.instanceOf(node)) { markedParents = new HashSet<>(); markedParents.add(node); } return super.visit(node, markedParents); }
protected boolean isDelayed(JexlNode testNode) { if (ASTDelayedPredicate.instanceOf(testNode)) { return true; } else if (IndexHoleMarkerJexlNode.instanceOf(testNode)) { return true; } else if (ExceededValueThresholdMarkerJexlNode.instanceOf(testNode)) { return true; } else if (ExceededTermThresholdMarkerJexlNode.instanceOf(testNode)) { return true; } else { return false; } }
protected boolean isDelayedPredicate(JexlNode currNode) { if (ASTDelayedPredicate.instanceOf(currNode) || ExceededOrThresholdMarkerJexlNode.instanceOf(currNode) || ExceededValueThresholdMarkerJexlNode.instanceOf(currNode) || ExceededTermThresholdMarkerJexlNode.instanceOf(currNode) || IndexHoleMarkerJexlNode.instanceOf(currNode)) return true; else return false; } }
@Override public Object visit(ASTReference node, Object data) { // delayed predicates are not run against the index (if acknowledging them) if (!(acknowledgeDelayedPredicates && ASTDelayedPredicate.instanceOf(node))) { if (!IndexHoleMarkerJexlNode.instanceOf(node)) { if (ExceededOrThresholdMarkerJexlNode.instanceOf(node) || ExceededValueThresholdMarkerJexlNode.instanceOf(node)) { ivarators++; indexedFieldCount++; } else { data = super.visit(node, data); } } } return data; }
protected static boolean isDelayedPredicate(JexlNode currNode) { if (ASTDelayedPredicate.instanceOf(currNode) || ExceededOrThresholdMarkerJexlNode.instanceOf(currNode) || ExceededValueThresholdMarkerJexlNode.instanceOf(currNode) || ExceededTermThresholdMarkerJexlNode.instanceOf(currNode) || IndexHoleMarkerJexlNode.instanceOf(currNode) || ASTEvaluationOnly.instanceOf(currNode)) return true; else return false; }
@Override public Object visit(ASTReference node, Object data) { // if a delayed predicate, then change it to a regular reference if (ASTDelayedPredicate.instanceOf(node)) { JexlNode source = ASTDelayedPredicate.getDelayedPredicateSource(node); JexlNodes.swap(node.jjtGetParent(), node, source); return source; } else if (!ExecutableDeterminationVisitor.isExecutable(node, config, indexedFields, indexOnlyFields, nonEventFields, false, null, helper)) { super.visit(node, data); } return node; }
/** * method to return if the current node is an instance of a delayed predicate * * @param currNode * @return */ protected boolean isDelayedPredicate(JexlNode currNode) { if (ASTDelayedPredicate.instanceOf(currNode) || ExceededOrThresholdMarkerJexlNode.instanceOf(currNode) || ExceededValueThresholdMarkerJexlNode.instanceOf(currNode) || ExceededTermThresholdMarkerJexlNode.instanceOf(currNode) || IndexHoleMarkerJexlNode.instanceOf(currNode) || ASTEvaluationOnly.instanceOf(currNode)) return true; else return false; }
@Override public Object visit(ASTJexlScript node, Object data) { setPushDown((PushDownVisitor) data); costEstimator = new CostEstimator(parentVisitor); if (log.isTraceEnabled()) log.trace("Setting cost estimator"); // don't rewrite yet ASTJexlScript newScript = new ASTJexlScript(ParserTreeConstants.JJTJEXLSCRIPT); // for this to work we should only have a single child Preconditions.checkArgument(node.jjtGetNumChildren() == 1); JexlNode child = node.jjtGetChild(0); if (ASTDelayedPredicate.instanceOf(child)) { child = child.jjtGetChild(0); child = (JexlNode) child.jjtAccept(this, data); child.jjtSetParent(newScript); newScript.jjtAddChild(child, 0); return newScript; } else return node; }
@Override public Object visit(ASTReference node, Object data) { if (ASTDelayedPredicate.instanceOf(node) || IndexHoleMarkerJexlNode.instanceOf(node) || ASTEvaluationOnly.instanceOf(node)) { return node; } else if (ExceededValueThresholdMarkerJexlNode.instanceOf(node) || ExceededTermThresholdMarkerJexlNode.instanceOf(node) || ExceededOrThresholdMarkerJexlNode.instanceOf(node)) { return node; } else return super.visit(node, data); }
@Override public Object visit(ASTAndNode node, Object data) { if (ExceededValueThresholdMarkerJexlNode.instanceOf(node) || ExceededTermThresholdMarkerJexlNode.instanceOf(node) || ExceededOrThresholdMarkerJexlNode.instanceOf(node) || ASTDelayedPredicate.instanceOf(node) || ASTEvaluationOnly.instanceOf(node)) { return super.visit(node, data); } else { ASTAndNode andNode = JexlNodes.newInstanceOfType(node); andNode.image = node.image; return flattenTree(node, andNode, data); } }
public static JexlNode getSourceNode(JexlNode delayedNode) { if (ASTDelayedPredicate.instanceOf(delayedNode)) { return ASTDelayedPredicate.getQueryPropertySource(delayedNode, ASTDelayedPredicate.class); } else if (ExceededValueThresholdMarkerJexlNode.instanceOf(delayedNode)) { return ExceededValueThresholdMarkerJexlNode.getExceededValueThresholdSource(delayedNode); } else if (ExceededTermThresholdMarkerJexlNode.instanceOf(delayedNode)) { return ExceededTermThresholdMarkerJexlNode.getExceededTermThresholdSource(delayedNode); } else if (IndexHoleMarkerJexlNode.instanceOf(delayedNode)) { return IndexHoleMarkerJexlNode.getIndexHoleSource(delayedNode); } else { return delayedNode; } }
@Override public Object visit(ASTReference node, Object data) { STATE state; // until we implement an ivarator that can handle an ExceededTermThreshold node, and ensure that the JexlContext gets // _ANYFIELD_ values, then we cannot execute these nodes if (ExceededTermThresholdMarkerJexlNode.instanceOf(node)) { state = STATE.NON_EXECUTABLE; } // if an ivarator the return true, else check out children else if (ExceededValueThresholdMarkerJexlNode.instanceOf(node) || ExceededOrThresholdMarkerJexlNode.instanceOf(node)) { state = STATE.EXECUTABLE; } // if a delayed predicate, then this is not-executable against the index by choice else if (ASTDelayedPredicate.instanceOf(node) || ASTEvaluationOnly.instanceOf(node)) { if (isNonEvent(node)) { state = STATE.ERROR; } else { state = STATE.NON_EXECUTABLE; } } else if (IndexHoleMarkerJexlNode.instanceOf(node)) { state = STATE.NON_EXECUTABLE; } else { state = allOrNone(node, data + PREFIX); } return state; }
} else if (ASTDelayedPredicate.instanceOf(node) || ASTEvaluationOnly.instanceOf(node)) { return ScannerStream.ignored(node); } else if (IndexHoleMarkerJexlNode.instanceOf(node)) {
@Test public void instanceOfTest() throws Exception { String baseQuery = "(GEO >= '0202' && GEO <= '020d') && (WKT_BYTE_LENGTH >= '+AE0' && WKT_BYTE_LENGTH < '+bE8')"; JexlNode baseQueryNode = JexlASTHelper.parseJexlQuery(baseQuery); JexlNode delayedNode = ASTDelayedPredicate.create(baseQueryNode); Assert.assertTrue(ASTDelayedPredicate.instanceOf(delayedNode)); JexlNode sourceNode = ASTDelayedPredicate.getDelayedPredicateSource(delayedNode); Assert.assertEquals(baseQuery, JexlStringBuildingVisitor.buildQuery(sourceNode)); String delayedQueryString = JexlStringBuildingVisitor.buildQuery(delayedNode); JexlNode reconstructedDelayedNode = JexlASTHelper.parseJexlQuery(delayedQueryString); Assert.assertTrue(ASTDelayedPredicate.instanceOf(reconstructedDelayedNode)); sourceNode = ASTDelayedPredicate.getDelayedPredicateSource(delayedNode); Assert.assertEquals(baseQuery, JexlStringBuildingVisitor.buildQuery(sourceNode)); } }
if (!removeReferences) { return super.visit(node, data); } else if (ASTDelayedPredicate.instanceOf(node) || IndexHoleMarkerJexlNode.instanceOf(node) || ASTEvaluationOnly.instanceOf(node)) { return super.visit(node, data); } else if (ExceededValueThresholdMarkerJexlNode.instanceOf(node) || ExceededTermThresholdMarkerJexlNode.instanceOf(node)