Ejemplo n.º 1
0
 private static ExprAndNode MakeValidateAndNode(
     IList<ExprNode> remainingExprNodes,
     FilterSpecCompilerArgs args)
 {
     var andNode = ExprNodeUtilityMake.ConnectExpressionsByLogicalAnd(remainingExprNodes);
     var validationContext = new ExprValidationContextBuilder(args.streamTypeService, args.statementRawInfo, args.compileTimeServices)
         .WithAllowBindingConsumption(true)
         .WithContextDescriptor(args.contextDescriptor)
         .Build();
     andNode.Validate(validationContext);
     return andNode;
 }
        private static ExprNode GetFilterExpressionInclOnClause(
            ExprNode whereClause,
            OuterJoinDesc[] outerJoinDescList,
            StatementRawInfo rawInfo,
            StatementCompileTimeServices services)
        {
            if (whereClause == null) { // no need to add as query planning is fully based on on-clause
                return null;
            }

            if (outerJoinDescList.Length == 0) { // not an outer-join syntax
                return whereClause;
            }

            if (!OuterJoinDesc.ConsistsOfAllInnerJoins(outerJoinDescList)) { // all-inner joins
                return whereClause;
            }

            var hasOnClauses = OuterJoinDesc.HasOnClauses(outerJoinDescList);
            if (!hasOnClauses) {
                return whereClause;
            }

            IList<ExprNode> expressions = new List<ExprNode>();
            expressions.Add(whereClause);

            foreach (var outerJoinDesc in outerJoinDescList) {
                if (outerJoinDesc.OptLeftNode != null) {
                    expressions.Add(outerJoinDesc.MakeExprNode(rawInfo, services));
                }
            }

            var andNode = ExprNodeUtilityMake.ConnectExpressionsByLogicalAnd(expressions);
            try {
                andNode.Validate(null);
            }
            catch (ExprValidationException ex) {
                throw new EPRuntimeException("Unexpected exception validating expression: " + ex.Message, ex);
            }

            return andNode;
        }