public bool Filter(int streamLookup, int streamIndexed, ExcludePlanFilterOperatorType opType, params ExprNode[] exprNodes) { EventBean @event = ExcludePlanHintExprUtil.ToEvent(streamLookup, streamIndexed, _streamNames[streamLookup], _streamNames[streamIndexed], opType.GetName().ToLower(), exprNodes); if (_queryPlanLogging && QueryPlanLog.IsInfoEnabled) { QueryPlanLog.Info("Exclude-plan-hint combination " + EventBeanUtility.PrintEvent(@event)); } EventBean[] eventsPerStream = new EventBean[] { @event }; var evaluateParams = new EvaluateParams(eventsPerStream, true, _exprEvaluatorContext); foreach (ExprEvaluator evaluator in _evaluators) { var pass = evaluator.Evaluate(evaluateParams); if (pass != null && true.Equals(pass)) { if (_queryPlanLogging && QueryPlanLog.IsInfoEnabled) { QueryPlanLog.Info("Exclude-plan-hint combination : true"); } return(true); } } if (_queryPlanLogging && QueryPlanLog.IsInfoEnabled) { QueryPlanLog.Info("Exclude-plan-hint combination : false"); } return(false); }
public static ExcludePlanHint GetHint(String[] streamNames, StatementContext statementContext) { IList <String> hints = HintEnum.EXCLUDE_PLAN.GetHintAssignedValues(statementContext.Annotations); if (hints == null) { return(null); } IList <ExprEvaluator> filters = new List <ExprEvaluator>(); foreach (String hint in hints) { if (string.IsNullOrWhiteSpace(hint)) { continue; } ExprEvaluator evaluator = ExcludePlanHintExprUtil.ToExpression(hint, statementContext); if (TypeHelper.GetBoxedType(evaluator.ReturnType) != typeof(bool?)) { throw new ExprValidationException("Expression provided for hint " + HintEnum.EXCLUDE_PLAN.GetValue() + " must return a boolean value"); } filters.Add(evaluator); } return(new ExcludePlanHint(streamNames, filters, statementContext)); }