Package com.espertech.esper.epl.expression

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


        Integer cached = cachedMaxPerChild[position];
        if (cached != null) {
            return cached;  // constant value cached
        }

        ExprEvaluator cachedExpr = cachedMaxEvaluatorPerChild[position];
        if (cachedExpr == null) {
            return -1// no limit defined for this sub-expression
        }

        Number result = (Number) cachedExpr.evaluate(null, true, null);
        if (result != null) {
            return result.intValue();
        }
        return -1// no limit
    }
View Full Code Here


                for (int i = 0; i < typesPerStream.length; i++)
                {
                    final int streamNum = i;
                    final Class returnType = typesPerStream[streamNum].getUnderlyingType();
                   
                    expressions.add(new ExprEvaluator() {

                        public Object evaluate(EventBean[] eventsPerStream, boolean isNewData, ExprEvaluatorContext exprEvaluatorContext)
                        {
                            EventBean event = eventsPerStream[streamNum];
                            if (event != null)
                            {
                                return event.getUnderlying();
                            }
                            else
                            {
                                return null;
                            }
                        }

                        public Class getType()
                        {
                            return returnType;
                        }

                        public Map<String, Object> getEventType() {
                            return null;
                        }
                    });
                    types.add(returnType);
                    columnNames.add(streamNames[streamNum]);
                }
            }

            // handle stream wildcards by outputting the stream underlying event
            else if (element instanceof SelectClauseStreamCompiledSpec)
            {
                final SelectClauseStreamCompiledSpec streamSpec = (SelectClauseStreamCompiledSpec) element;
                final Class returnType = typesPerStream[streamSpec.getStreamNumber()].getUnderlyingType();

                expressions.add(new ExprEvaluator() {

                    public Object evaluate(EventBean[] eventsPerStream, boolean isNewData, ExprEvaluatorContext exprEvaluatorContext)
                    {
                        EventBean event = eventsPerStream[streamSpec.getStreamNumber()];
                        if (event != null)
                        {
                            return event.getUnderlying();
                        }
                        else
                        {
                            return null;
                        }
                    }

                    public Class getType()
                    {
                        return returnType;
                    }

                    public Map<String, Object> getEventType() {
                        return null;
                    }
                });
                types.add(returnType);
                columnNames.add(streamNames[streamSpec.getStreamNumber()]);
            }

            // handle expressions
            else if (element instanceof SelectClauseExprCompiledSpec)
            {
                SelectClauseExprCompiledSpec expr = (SelectClauseExprCompiledSpec) element;
                ExprEvaluator evaluator = expr.getSelectExpression().getExprEvaluator();
                expressions.add(evaluator);
                types.add(evaluator.getType());
                if (expr.getAssignedName() != null)
                {
                    columnNames.add(expr.getAssignedName());
                }
                else
View Full Code Here

        return new EventType[0];
    }

    public EnumEval getEnumEval(EventAdapterService eventAdapterService, StreamTypeService streamTypeService, String statementId, String enumMethodUsedName, List<ExprDotEvalParam> bodiesAndParameters, EventType inputEventType, Class collectionComponentType, int numStreamsIncoming) throws ExprValidationException {
        super.setTypeInfo(ExprDotEvalTypeInfo.scalarOrUnderlying(Boolean.class));
        ExprEvaluator body = bodiesAndParameters.get(0).getBodyEvaluator();
        return new EnumEvalSequenceEqual(body, numStreamsIncoming);
    }
View Full Code Here

    public EventType[] getAddStreamTypes(String enumMethodUsedName, List<String> goesToNames, EventType inputEventType, Class collectionComponentType, List<ExprDotEvalParam> bodiesAndParameters) {
        return new EventType[] {};
    }

    public EnumEval getEnumEval(EventAdapterService eventAdapterService, StreamTypeService streamTypeService, String statementId, String enumMethodUsedName, List<ExprDotEvalParam> bodiesAndParameters, EventType inputEventType, Class collectionComponentType, int numStreamsIncoming) {
        ExprEvaluator sizeEval = bodiesAndParameters.get(0).getBodyEvaluator();
       
        if (inputEventType != null) {
            super.setTypeInfo(ExprDotEvalTypeInfo.eventColl(inputEventType));
        }
        else {
View Full Code Here

            if (index == -1) {
                throw new IllegalStateException("Could not find index property for lookup '" + indexedKeyProps[i]);
            }
            hashesDesc[i] = hashJoinedProps[index];
            hashPropCoercionTypes[i] = indexedKeyProps[i].getCoercionType();
            ExprEvaluator evaluatorHashkey = hashesDesc[i].getHashKey().getKeyExpr().getExprEvaluator();
            if (evaluatorHashkey != null && indexedKeyProps[i].getCoercionType() != evaluatorHashkey.getType()) {   // we allow null evaluator
                isCoerceHash = true;
            }
        }

        // map the order of range columns (range) to the range information available
View Full Code Here

                        actions.add(setupInsert(count, insertDesc, triggeringEventType, triggeringStreamName, statementContext));
                    }
                    else if (item instanceof OnTriggerMergeActionUpdate) {
                        OnTriggerMergeActionUpdate updateDesc = (OnTriggerMergeActionUpdate) item;
                        NamedWindowUpdateHelper updateHelper = NamedWindowUpdateHelper.make(eventTypeSPI, updateDesc.getAssignments(), onTriggerDesc.getOptionalAsName());
                        ExprEvaluator filterEval = updateDesc.getOptionalWhereClause() == null ? null : updateDesc.getOptionalWhereClause().getExprEvaluator();
                        actions.add(new NamedWindowOnMergeActionUpd(filterEval, updateHelper));
                    }
                    else if (item instanceof OnTriggerMergeActionDelete) {
                        OnTriggerMergeActionDelete deleteDesc = (OnTriggerMergeActionDelete) item;
                        ExprEvaluator filterEval = deleteDesc.getOptionalWhereClause() == null ? null : deleteDesc.getOptionalWhereClause().getExprEvaluator();
                        actions.add(new NamedWindowOnMergeActionDel(filterEval));
                    }
                    else {
                        throw new IllegalArgumentException("Invalid type of merge item '" + item.getClass() + "'");
                    }
View Full Code Here

        // Get select expr processor
        SelectExprEventTypeRegistry selectExprEventTypeRegistry = new SelectExprEventTypeRegistry(new HashSet<String>());
        SelectExprProcessor insertHelper = SelectExprProcessorFactory.getProcessor(Collections.singleton(selectClauseNumber), selectNoWildcard, false, insertIntoDesc, null, streamTypeService,
                statementContext.getEventAdapterService(), statementResultService, statementContext.getValueAddEventService(), selectExprEventTypeRegistry,
                statementContext.getMethodResolutionService(), statementContext, statementContext.getVariableService(), statementContext.getTimeProvider(), statementContext.getEngineURI(), statementContext.getStatementId(), statementContext.getStatementName(), statementContext.getAnnotations());
        ExprEvaluator filterEval = desc.getOptionalWhereClause() == null ? null : desc.getOptionalWhereClause().getExprEvaluator();

        InternalEventRouter routerToUser = streamName.equals(namedWindowName) ? null : internalEventRouter;
        return new NamedWindowOnMergeActionIns(filterEval, insertHelper, routerToUser, statementContext.getEpStatementHandle(), statementContext.getInternalEventEngineRouteDest());
    }   
View Full Code Here

            if (index == -1) {
                throw new IllegalStateException("Could not find index property for lookup '" + indexedKeyProps[i]);
            }
            hashesDesc[i] = hashJoinedProps[index];
            hashPropCoercionTypes[i] = indexedKeyProps[i].getCoercionType();
            ExprEvaluator evaluatorHashkey = hashesDesc[i].getHashKey().getKeyExpr().getExprEvaluator();
            if (evaluatorHashkey != null && indexedKeyProps[i].getCoercionType() != evaluatorHashkey.getType()) {   // we allow null evaluator
                isCoerceHash = true;
            }
        }

        // map the order of range columns (range) to the range information available
View Full Code Here

        Integer cached = cachedMaxPerChild[position];
        if (cached != null) {
            return cached;  // constant value cached
        }

        ExprEvaluator cachedExpr = cachedMaxEvaluatorPerChild[position];
        if (cachedExpr == null) {
            return -1// no limit defined for this sub-expression
        }

        Number result = (Number) cachedExpr.evaluate(null, true, null);
        if (result != null) {
            return result.intValue();
        }
        return -1// no limit
    }
View Full Code Here

        InternalEventRouterEntry lastEntry = null;

        for (int i = 0; i < entries.length; i++)
        {
            InternalEventRouterEntry entry = entries[i];
            ExprEvaluator whereClause = entry.getOptionalWhereClause();
            if (whereClause != null)
            {
                Boolean result = (Boolean) whereClause.evaluate(eventsPerStream, true, exprEvaluatorContext);
                if ((result == null) || (!result))
                {
                    continue;
                }
            }
View Full Code Here

TOP

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

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.