public static final boolean isEvaluatable(LanguageObject obj, EvaluationLevel target) { EvaluatableVisitor visitor = new EvaluatableVisitor(); visitor.targetLevel = target; PreOrderNavigator.doVisit(obj, visitor); return visitor.isEvaluationPossible(); }
@Override protected void visitNode(LanguageObject obj) { if (obj == null) { return; } Determinism d = ev.getDeterminismLevel(); boolean pushDown = ev.requiresEvaluation(EvaluationLevel.PUSH_DOWN); //descend with clean state, then restore ev.reset(); super.visitNode(obj); ev.setDeterminismLevel(d); if (pushDown) { ev.evaluationNotPossible(EvaluationLevel.PUSH_DOWN); } }
/** * Should be called to check if the object can fully evaluated */ public static final boolean isFullyEvaluatable(LanguageObject obj, boolean duringPlanning) { return isEvaluatable(obj, duringPlanning?EvaluationLevel.PLANNING:EvaluationLevel.PROCESSING); }
public void visit(DependentSetCriteria obj) { //without knowing what is feeding this, we need to treat it as non-deterministic setDeterminismLevel(Determinism.NONDETERMINISTIC); evaluationNotPossible(EvaluationLevel.PROCESSING); }
command = aliasCommand(aNode, command, modelID); ev = EvaluatableVisitor.needsEvaluationVisitor(modelID, metadata, capFinder); if (!shouldEval && modelID != null) { if (!capVisitor.isValid()) { ev.evaluationNotPossible(EvaluationLevel.PROCESSING); aNode.setShouldEvaluateExpressions(ev.requiresEvaluation(EvaluationLevel.PROCESSING) || shouldEval); aNode.setCommand(command); if (modelID != null) { if (ev != null && ev.getDeterminismLevel().compareTo(Determinism.COMMAND_DETERMINISTIC) >= 0 && command.areResultsCachable()) { checkForSharedSourceCommand(aNode);
private Criteria evaluateCriteria(Criteria crit) throws TeiidComponentException, TeiidProcessingException{ if(EvaluatableVisitor.isFullyEvaluatable(crit, !processing)) { try { Boolean eval = evaluator.evaluateTVL(crit, Collections.emptyList()); return getCriteria(eval); } catch(ExpressionEvaluationException e) { throw new QueryValidatorException(QueryPlugin.Event.TEIID30372, e, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30372, crit)); } } return crit; }
@Override public void visit(IsDistinctCriteria isDistinctCriteria) { evaluationNotPossible(EvaluationLevel.PROCESSING); }
return; if (!ev.requiresEvaluation(EvaluationLevel.PUSH_DOWN) && ev.getDeterminismLevel() != Determinism.NONDETERMINISTIC) { if (obj instanceof ElementSymbol) { ElementSymbol es = (ElementSymbol)obj;
if (!EvaluatableVisitor.isFullyEvaluatable(expression, true)) { return expression; } else if (!(expression instanceof Reference) && !EvaluatableVisitor.isEvaluatable(expression, EvaluationLevel.PROCESSING)) { return expression;
log(report, model, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID31114, exprString, fbi.getFullName())); EvaluatableVisitor ev = new EvaluatableVisitor(); PreOrPostOrderNavigator.doVisit(ex, ev, PreOrPostOrderNavigator.PRE_ORDER); if (ev.getDeterminismLevel().compareTo(Determinism.VDB_DETERMINISTIC) < 0) { log(report, model, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID31115, exprString, fbi.getFullName()));
private BatchedUpdateNode helpGetNode(String[] sql, QueryMetadataInterface md, ProcessorDataManager pdm) throws Exception { List<Command> commands = TestBatchedUpdatePlanner.helpGetCommands(sql, md); List<Boolean> shouldEvaluate = new ArrayList<Boolean>(commands.size()); for (Command command : commands) { shouldEvaluate.add(EvaluatableVisitor.needsProcessingEvaluation(command)); } BatchedUpdateNode node = new BatchedUpdateNode(1, commands, Collections.EMPTY_LIST, shouldEvaluate, "myModelName"); //$NON-NLS-1$ CommandContext context = new CommandContext(); context.setMetadata(md); node.initialize(context, Mockito.mock(BufferManager.class), pdm); return node; }
public static final EvaluatableVisitor needsEvaluationVisitor(Object modelID, QueryMetadataInterface metadata, CapabilitiesFinder capFinder) { EvaluatableVisitor visitor = new EvaluatableVisitor(); visitor.modelId = modelID; visitor.metadata = metadata; visitor.capFinder = capFinder; return visitor; }
command = aliasCommand(aNode, command, modelID); ev = EvaluatableVisitor.needsEvaluationVisitor(modelID, metadata, capFinder); if (!shouldEval && modelID != null) { if (!capVisitor.isValid()) { ev.evaluationNotPossible(EvaluationLevel.PROCESSING); aNode.setShouldEvaluateExpressions(ev.requiresEvaluation(EvaluationLevel.PROCESSING) || shouldEval); aNode.setCommand(command); if (modelID != null) { if (ev != null && ev.getDeterminismLevel().compareTo(Determinism.INSTRUCTION_DETERMINISTIC) >= 0 && command.areResultsCachable()) { checkForSharedSourceCommand(aNode, node);
private Criteria evaluateCriteria(Criteria crit) throws TeiidComponentException, TeiidProcessingException{ if(EvaluatableVisitor.isFullyEvaluatable(crit, !processing)) { try { Boolean eval = evaluator.evaluateTVL(crit, Collections.emptyList()); return getCriteria(eval); } catch(ExpressionEvaluationException e) { throw new QueryValidatorException(QueryPlugin.Event.TEIID30372, e, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30372, crit)); } } return crit; }
public void visit(DependentSetCriteria obj) { //without knowing what is feeding this, we need to treat it as non-deterministic setDeterminismLevel(Determinism.NONDETERMINISTIC); evaluationNotPossible(EvaluationLevel.PROCESSING); }
public void visit(ExpressionSymbol obj) { evaluationNotPossible(EvaluationLevel.PUSH_DOWN); }
return; if (!ev.requiresEvaluation(EvaluationLevel.PUSH_DOWN) && ev.getDeterminismLevel() != Determinism.NONDETERMINISTIC) { if (obj instanceof ElementSymbol) { ElementSymbol es = (ElementSymbol)obj;
if (!EvaluatableVisitor.isFullyEvaluatable(expression, true)) { return expression; } else if (!(expression instanceof Reference) && !EvaluatableVisitor.isEvaluatable(expression, EvaluationLevel.PROCESSING)) { return expression;
log(report, model, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID31114, exprString, fbi.getFullName())); EvaluatableVisitor ev = new EvaluatableVisitor(); PreOrPostOrderNavigator.doVisit(ex, ev, PreOrPostOrderNavigator.PRE_ORDER); if (ev.getDeterminismLevel().compareTo(Determinism.VDB_DETERMINISTIC) < 0) { log(report, model, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID31115, exprString, fbi.getFullName()));
shouldEvaluate.add(Boolean.TRUE); } else { shouldEvaluate.add(EvaluatableVisitor.needsProcessingEvaluation(updateCommand)); shouldEvaluate.add(Boolean.TRUE); } else { shouldEvaluate.add(EvaluatableVisitor.needsProcessingEvaluation(batchingCandidate));