public Reduction CreateRULE_QUERY_SELECT_WHERE2(Reduction reduction) { //selectType can be one of the following depending on the query text: - // AggregateFunctionPredicate that has IsOfTypePredicate set as its ChildPredicate object selectType = ((Reduction)reduction.GetToken(1).Data).Tag; Predicate lhs = null; Predicate rhs = (Predicate)((Reduction)reduction.GetToken(3).Data).Tag; Predicate selectTypePredicate = selectType as Predicate; Predicate result = null; AggregateFunctionPredicate parentPredicate = selectTypePredicate as AggregateFunctionPredicate; lhs = parentPredicate.ChildPredicate; parentPredicate.ChildPredicate = ExpressionBuilder.CreateLogicalAndPredicate(lhs, rhs); result = parentPredicate; reduction.Tag = result; if (NCacheLog.IsInfoEnabled) { NCacheLog.Info("CreateRULE_QUERY_SELECT_WHERE2"); } return(null); }
/// Implements <CountFunction> ::= 'COUNT(' <Property> ')' public Reduction CreateRULE_COUNTFUNCTION_COUNTLPARAN_TIMES_RPARAN(Reduction reduction) { string typeName = ((Reduction)reduction.GetToken(1).Data).Tag as string; Predicate childPredicate = new IsOfTypePredicate(typeName); AggregateFunctionPredicate countFunctionPredicate = ExpressionBuilder.CreateCountFunctionPredicate() as AggregateFunctionPredicate; countFunctionPredicate.ChildPredicate = childPredicate; reduction.Tag = countFunctionPredicate; return(null); }
/// Implements <AverageFunction> ::= 'AVG(' <TypePlusAttribute> ')' public Reduction CreateRULE_AVERAGEFUNCTION_AVGLPARAN_RPARAN(Reduction reduction) { Reduction typePlusAttributeReduction = (Reduction)reduction.GetToken(1).Data; string typeName = ((Reduction)typePlusAttributeReduction.GetToken(0).Data).Tag as string; string memberName = ((Reduction)typePlusAttributeReduction.GetToken(2).Data).Tag as string; Predicate childPredicate = new IsOfTypePredicate(typeName); AggregateFunctionPredicate avgFunctionPredicate = ExpressionBuilder.CreateAverageFunctionPredicate(memberName) as AggregateFunctionPredicate; avgFunctionPredicate.ChildPredicate = childPredicate; reduction.Tag = avgFunctionPredicate; return(null); }