Package com.espertech.esper.epl.expression

Examples of com.espertech.esper.epl.expression.ExprIdentNode


    private QueryGraphValueDesc findIdentEntry(ExprIdentNode search) {
        for (QueryGraphValueDesc desc : items) {
            if (desc.getIndexExprs().length > 1 || !(desc.getIndexExprs()[0] instanceof ExprIdentNode)) {
                continue;
            }
            ExprIdentNode other = (ExprIdentNode) desc.getIndexExprs()[0];
            if (search.getResolvedPropertyName().equals(other.getResolvedPropertyName())) {
                return desc;
            }
        }
        return null;
    }
View Full Code Here


    private String getSingleIdentNodeProp(ExprNode[] indexExprs) {
        if (indexExprs.length != 1) {
            throw new IllegalStateException("Incorrect number of index expressions");
        }
        ExprIdentNode identNode = (ExprIdentNode) indexExprs[0];
        return identNode.getResolvedPropertyName();
    }
View Full Code Here

        if (targetStreamNum == parameterStreamNum) {
            return;
        }

        ExprIdentNode targetStartExpr = ExprNodeUtility.getExprIdentNode(typesPerStream, targetStreamNum, targetStartProp);
        ExprIdentNode targetEndExpr = ExprNodeUtility.getExprIdentNode(typesPerStream, targetStreamNum, targetEndProp);
        ExprIdentNode parameterStartExpr = ExprNodeUtility.getExprIdentNode(typesPerStream, parameterStreamNum, parameterStartProp);
        ExprIdentNode parameterEndExpr = ExprNodeUtility.getExprIdentNode(typesPerStream, parameterStreamNum, parameterEndProp);

        if (targetStartExpr.getExprEvaluator().getType() != parameterStartExpr.getExprEvaluator().getType()) {
            return;
        }

        if (currentMethod == DatetimeMethodEnum.BEFORE) {
            // a.end < b.start
            queryGraph.addRelationalOpStrict(targetStreamNum, targetEndExpr,
                    parameterStreamNum, parameterStartExpr,
                    RelationalOpEnum.LT);
        }
        else if (currentMethod == DatetimeMethodEnum.AFTER) {
            // a.start > b.end
            queryGraph.addRelationalOpStrict(targetStreamNum, targetStartExpr,
                    parameterStreamNum, parameterEndExpr,
                    RelationalOpEnum.GT);
        }
        else if (currentMethod == DatetimeMethodEnum.COINCIDES) {
            // a.startTimestamp = b.startTimestamp and a.endTimestamp = b.endTimestamp
            queryGraph.addStrictEquals(targetStreamNum, targetStartProp, targetStartExpr,
                    parameterStreamNum, parameterStartProp, parameterStartExpr);

            boolean noDuration = parameterEndProp.equals(parameterStartProp) && targetEndProp.equals(targetStartProp);
            if (!noDuration) {
                ExprIdentNode leftEndExpr = ExprNodeUtility.getExprIdentNode(typesPerStream, targetStreamNum, targetEndProp);
                ExprIdentNode rightEndExpr = ExprNodeUtility.getExprIdentNode(typesPerStream, parameterStreamNum, parameterEndProp);
                queryGraph.addStrictEquals(targetStreamNum, targetEndProp, leftEndExpr,
                        parameterStreamNum, parameterEndProp, rightEndExpr);
            }
        }
        else if (currentMethod == DatetimeMethodEnum.DURING || currentMethod == DatetimeMethodEnum.INCLUDES) {
View Full Code Here

                             QueryGraph queryGraph) {
        if ( ((target instanceof ExprIdentNode)) &&
             ((start instanceof ExprIdentNode)) &&
             ((end instanceof ExprIdentNode)) )
        {
            ExprIdentNode identNodeValue = (ExprIdentNode) target;
            ExprIdentNode identNodeStart = (ExprIdentNode) start;
            ExprIdentNode identNodeEnd = (ExprIdentNode) end;

            int keyStreamStart = identNodeStart.getStreamId();
            int keyStreamEnd = identNodeEnd.getStreamId();
            int valueStream = identNodeValue.getStreamId();
            queryGraph.addRangeStrict(keyStreamStart, identNodeStart.getResolvedPropertyName(), identNodeStart, keyStreamEnd,
                    identNodeEnd.getResolvedPropertyName(), identNodeEnd, valueStream,
                    identNodeValue.getResolvedPropertyName(), identNodeValue,
                    includeStart, includeEnd, isNot);
            return;
        }

        // handle constant-compare or transformation case
        if (target instanceof ExprIdentNode) {
            ExprIdentNode identNode = (ExprIdentNode) target;
            int indexedStream = identNode.getStreamId();
            String indexedProp = identNode.getResolvedPropertyName();

            EligibilityDesc eligibilityStart = EligibilityUtil.verifyInputStream(start, indexedStream);
            if (!eligibilityStart.getEligibility().isEligible()) {
                return;
            }
View Full Code Here

            }

            if (otherPropertyNum != -1)
            {
                if (otherStrictKeyProps[otherPropertyNum] != null) {
                    ExprIdentNode identNodeLookup = new ExprIdentNodeImpl(typesPerStream[lookupStream], keyProp, lookupStream);
                    ExprIdentNode identNodeOther = new ExprIdentNodeImpl(typesPerStream[otherStream], otherStrictKeyProps[otherPropertyNum], otherStream);
                    boolean added = queryGraph.addStrictEquals(lookupStream, keyProp, identNodeLookup, otherStream, otherStrictKeyProps[otherPropertyNum], identNodeOther);
                    if (added)
                    {
                        addedEquivalency = true;
                    }
View Full Code Here

    {
        for (OuterJoinDesc outerJoinDesc : outerJoinDescList)
        {
            // add optional on-expressions
            if (outerJoinDesc.getOptLeftNode() != null) {
                ExprIdentNode identNodeLeft = outerJoinDesc.getOptLeftNode();
                ExprIdentNode identNodeRight = outerJoinDesc.getOptRightNode();

                add(queryGraph, identNodeLeft, identNodeRight);

                if (outerJoinDesc.getAdditionalLeftNodes() != null)
                {
View Full Code Here

        if (targetStreamNum == parameterStreamNum) {
            return;
        }

        ExprIdentNode targetStartExpr = ExprNodeUtility.getExprIdentNode(typesPerStream, targetStreamNum, targetStartProp);
        ExprIdentNode targetEndExpr = ExprNodeUtility.getExprIdentNode(typesPerStream, targetStreamNum, targetEndProp);
        ExprIdentNode parameterStartExpr = ExprNodeUtility.getExprIdentNode(typesPerStream, parameterStreamNum, parameterStartProp);
        ExprIdentNode parameterEndExpr = ExprNodeUtility.getExprIdentNode(typesPerStream, parameterStreamNum, parameterEndProp);

        if (targetStartExpr.getExprEvaluator().getType() != parameterStartExpr.getExprEvaluator().getType()) {
            return;
        }

        if (currentMethod == DatetimeMethodEnum.BEFORE) {
            // a.end < b.start
            queryGraph.addRelationalOpStrict(targetStreamNum, targetEndProp, targetEndExpr,
                    parameterStreamNum, parameterStartProp, parameterStartExpr,
                    RelationalOpEnum.LT);
        }
        else if (currentMethod == DatetimeMethodEnum.AFTER) {
            // a.start > b.end
            queryGraph.addRelationalOpStrict(targetStreamNum, targetStartProp, targetStartExpr,
                    parameterStreamNum, parameterEndProp, parameterEndExpr,
                    RelationalOpEnum.GT);
        }
        else if (currentMethod == DatetimeMethodEnum.COINCIDES) {
            // a.startTimestamp = b.startTimestamp and a.endTimestamp = b.endTimestamp
            queryGraph.addStrictEquals(targetStreamNum, targetStartProp, targetStartExpr,
                    parameterStreamNum, parameterStartProp, parameterStartExpr);

            boolean noDuration = parameterEndProp.equals(parameterStartProp) && targetEndProp.equals(targetStartProp);
            if (!noDuration) {
                ExprIdentNode leftEndExpr = ExprNodeUtility.getExprIdentNode(typesPerStream, targetStreamNum, targetEndProp);
                ExprIdentNode rightEndExpr = ExprNodeUtility.getExprIdentNode(typesPerStream, parameterStreamNum, parameterEndProp);
                queryGraph.addStrictEquals(targetStreamNum, targetEndProp, leftEndExpr,
                        parameterStreamNum, parameterEndProp, rightEndExpr);
            }
        }
        else if (currentMethod == DatetimeMethodEnum.DURING || currentMethod == DatetimeMethodEnum.INCLUDES) {
View Full Code Here

    {
      if(node.getChildNodes().length > 0)
      {
        throw new IllegalStateException("Ident node has unexpected child nodes");
      }
            ExprIdentNode identNode = (ExprIdentNode) node;
      return identNode.getUnresolvedPropertyName().equals(name) && identNode.getStreamOrPropertyName() == null;
    }
    else
    {
      return false;
    }
View Full Code Here

TOP

Related Classes of com.espertech.esper.epl.expression.ExprIdentNode

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.