Esempio n. 1
0
 public EvalInsertWildcardJoin(SelectExprContext selectExprContext,
                               EventType resultEventType,
                               SelectExprProcessor joinWildcardProcessor)
     : base(selectExprContext, resultEventType)
 {
     _joinWildcardProcessor = joinWildcardProcessor;
 }
Esempio n. 2
0
 /// <summary>
 /// Ctor.
 /// </summary>
 /// <param name="selectExprProcessor">for processing the select expression and generting the readonly output rows</param>
 /// <param name="groupKeyNodeExpressions">The group key node expressions.</param>
 /// <param name="groupKeyNodes">list of group-by expression nodes needed for building the group-by keys</param>
 /// <param name="optionalHavingNode">expression node representing validated HAVING clause, or null if none given.Aggregation functions in the having node must have been pointed to the AggregationService for evaluation.</param>
 /// <param name="isSelectRStream">true if remove stream events should be generated</param>
 /// <param name="isUnidirectional">true if unidirectional join</param>
 /// <param name="outputLimitSpec">The output limit spec.</param>
 /// <param name="isSorting">if set to <c>true</c> [is sorting].</param>
 /// <param name="isHistoricalOnly">if set to <c>true</c> [is historical only].</param>
 /// <param name="resultSetProcessorHelperFactory">The result set processor helper factory.</param>
 /// <param name="optionalOutputFirstConditionFactory">The optional output first condition factory.</param>
 /// <param name="enableOutputLimitOpt">if set to <c>true</c> [enable output limit opt].</param>
 /// <param name="numStreams">The number streams.</param>
 public ResultSetProcessorAggregateGroupedFactory(
     SelectExprProcessor selectExprProcessor,
     ExprNode[] groupKeyNodeExpressions,
     ExprEvaluator[] groupKeyNodes,
     ExprEvaluator optionalHavingNode,
     bool isSelectRStream,
     bool isUnidirectional,
     OutputLimitSpec outputLimitSpec,
     bool isSorting,
     bool isHistoricalOnly,
     ResultSetProcessorHelperFactory resultSetProcessorHelperFactory,
     OutputConditionPolledFactory optionalOutputFirstConditionFactory,
     bool enableOutputLimitOpt,
     int numStreams)
 {
     _selectExprProcessor    = selectExprProcessor;
     GroupKeyNodeExpressions = groupKeyNodeExpressions;
     GroupKeyNode            = groupKeyNodes.Length == 1 ? groupKeyNodes[0] : null;
     GroupKeyNodes           = groupKeyNodes;
     OptionalHavingNode      = optionalHavingNode;
     IsSorting        = isSorting;
     IsSelectRStream  = isSelectRStream;
     IsUnidirectional = isUnidirectional;
     IsHistoricalOnly = isHistoricalOnly;
     OutputLimitSpec  = outputLimitSpec;
     ResultSetProcessorHelperFactory     = resultSetProcessorHelperFactory;
     OptionalOutputFirstConditionFactory = optionalOutputFirstConditionFactory;
     IsEnableOutputLimitOpt = enableOutputLimitOpt;
     NumStreams             = numStreams;
 }
Esempio n. 3
0
 /// <summary>
 /// Ctor.
 /// </summary>
 /// <param name="selectExprProcessor">for processing the select expression and generting the final output rows</param>
 /// <param name="groupKeyNodeExpressions">The group key node expressions.</param>
 /// <param name="groupKeyNodes">list of group-by expression nodes needed for building the group-by keys</param>
 /// <param name="optionalHavingNode">expression node representing validated HAVING clause, or null if none given.Aggregation functions in the having node must have been pointed to the AggregationService for evaluation.</param>
 /// <param name="isSelectRStream">true if remove stream events should be generated</param>
 /// <param name="isUnidirectional">true if unidirectional join</param>
 /// <param name="outputLimitSpec">The output limit spec.</param>
 /// <param name="isSorting">if set to <c>true</c> [is sorting].</param>
 /// <param name="noDataWindowSingleStream">if set to <c>true</c> [no data window single stream].</param>
 /// <param name="isHistoricalOnly">if set to <c>true</c> [is historical only].</param>
 /// <param name="iterateUnbounded">if set to <c>true</c> [iterate unbounded].</param>
 /// <param name="resultSetProcessorHelperFactory">The result set processor helper factory.</param>
 /// <param name="enableOutputLimitOpt">if set to <c>true</c> [enable output limit opt].</param>
 /// <param name="numStreams">The number streams.</param>
 /// <param name="optionalOutputFirstConditionFactory">The optional output first condition factory.</param>
 public ResultSetProcessorRowPerGroupFactory(
     SelectExprProcessor selectExprProcessor,
     ExprNode[] groupKeyNodeExpressions,
     ExprEvaluator[] groupKeyNodes,
     ExprEvaluator optionalHavingNode,
     bool isSelectRStream,
     bool isUnidirectional,
     OutputLimitSpec outputLimitSpec,
     bool isSorting,
     bool noDataWindowSingleStream,
     bool isHistoricalOnly,
     bool iterateUnbounded,
     ResultSetProcessorHelperFactory resultSetProcessorHelperFactory,
     bool enableOutputLimitOpt,
     int numStreams,
     OutputConditionPolledFactory optionalOutputFirstConditionFactory)
 {
     _groupKeyNodeExpressions = groupKeyNodeExpressions;
     _selectExprProcessor     = selectExprProcessor;
     _groupKeyNodes           = groupKeyNodes;
     _groupKeyNode            = groupKeyNodes.Length == 1 ? groupKeyNodes[0] : null;
     _optionalHavingNode      = optionalHavingNode;
     _isSorting                          = isSorting;
     _isSelectRStream                    = isSelectRStream;
     _isUnidirectional                   = isUnidirectional;
     _outputLimitSpec                    = outputLimitSpec;
     _noDataWindowSingleSnapshot         = iterateUnbounded || (outputLimitSpec != null && outputLimitSpec.DisplayLimit == OutputLimitLimitType.SNAPSHOT && noDataWindowSingleStream);
     _isHistoricalOnly                   = isHistoricalOnly;
     ResultSetProcessorHelperFactory     = resultSetProcessorHelperFactory;
     IsEnableOutputLimitOpt              = enableOutputLimitOpt;
     NumStreams                          = numStreams;
     OptionalOutputFirstConditionFactory = optionalOutputFirstConditionFactory;
 }
 /// <summary>
 /// Ctor.
 /// </summary>
 /// <param name="selectExprProcessor">for processing the select expression and generting the final output rows</param>
 /// <param name="groupKeyNodeExpressions">The group key node expressions.</param>
 /// <param name="groupKeyNodes">list of group-by expression nodes needed for building the group-by keys</param>
 /// <param name="optionalHavingNode">expression node representing validated HAVING clause, or null if none given.Aggregation functions in the having node must have been pointed to the AggregationService for evaluation.</param>
 /// <param name="isSelectRStream">true if remove stream events should be generated</param>
 /// <param name="isUnidirectional">true if unidirectional join</param>
 /// <param name="outputLimitSpec">The output limit spec.</param>
 /// <param name="isSorting">if set to <c>true</c> [is sorting].</param>
 /// <param name="noDataWindowSingleStream">if set to <c>true</c> [no data window single stream].</param>
 /// <param name="isHistoricalOnly">if set to <c>true</c> [is historical only].</param>
 public ResultSetProcessorRowPerGroupFactory(
     SelectExprProcessor selectExprProcessor,
     ExprNode[] groupKeyNodeExpressions,
     ExprEvaluator[] groupKeyNodes,
     ExprEvaluator optionalHavingNode,
     bool isSelectRStream,
     bool isUnidirectional,
     OutputLimitSpec outputLimitSpec,
     bool isSorting,
     bool noDataWindowSingleStream,
     bool isHistoricalOnly,
     bool iterateUnbounded)
 {
     _groupKeyNodeExpressions = groupKeyNodeExpressions;
     _selectExprProcessor     = selectExprProcessor;
     _groupKeyNodes           = groupKeyNodes;
     _groupKeyNode            = groupKeyNodes.Length == 1 ? groupKeyNodes[0] : null;
     _optionalHavingNode      = optionalHavingNode;
     _isSorting                  = isSorting;
     _isSelectRStream            = isSelectRStream;
     _isUnidirectional           = isUnidirectional;
     _outputLimitSpec            = outputLimitSpec;
     _noDataWindowSingleSnapshot = iterateUnbounded || (outputLimitSpec != null && outputLimitSpec.DisplayLimit == OutputLimitLimitType.SNAPSHOT && noDataWindowSingleStream);
     _isHistoricalOnly           = isHistoricalOnly;
 }
 public EPPreparedExecuteIUDSingleStreamExecInsert(ExprEvaluatorContext exprEvaluatorContext, SelectExprProcessor insertHelper, ExprTableAccessNode[] optionalTableNodes, EPServicesContext services)
 {
     _exprEvaluatorContext = exprEvaluatorContext;
     _insertHelper         = insertHelper;
     _optionalTableNodes   = optionalTableNodes;
     _services             = services;
 }
Esempio n. 6
0
        internal static void PopulateSelectJoinEventsHavingWithOrderBy(SelectExprProcessor exprProcessor, OrderByProcessor orderByProcessor, ICollection <MultiKey <EventBean> > events, ExprEvaluator havingNode, bool isNewData, bool isSynthesize, ICollection <EventBean> result, ICollection <Object> sortKeys, ExprEvaluatorContext exprEvaluatorContext)
        {
            if (events == null)
            {
                return;
            }

            foreach (var key in events)
            {
                var eventsPerStream = key.Array;
                var evaluateParams  = new EvaluateParams(eventsPerStream, isNewData, exprEvaluatorContext);

                if (InstrumentationHelper.ENABLED)
                {
                    InstrumentationHelper.Get().QHavingClauseJoin(eventsPerStream);
                }
                var passesHaving = havingNode.Evaluate(evaluateParams);
                if (InstrumentationHelper.ENABLED)
                {
                    InstrumentationHelper.Get().AHavingClauseJoin(passesHaving.AsBoxedBoolean());
                }
                if ((passesHaving == null) || (false.Equals(passesHaving)))
                {
                    continue;
                }

                var resultEvent = exprProcessor.Process(eventsPerStream, isNewData, isSynthesize, exprEvaluatorContext);
                if (resultEvent != null)
                {
                    result.Add(resultEvent);
                    sortKeys.Add(orderByProcessor.GetSortKey(eventsPerStream, isNewData, exprEvaluatorContext));
                }
            }
        }
Esempio n. 7
0
        internal static void PopulateSelectEventsHaving(SelectExprProcessor exprProcessor, EventBean[] events, ExprEvaluator havingNode, bool isNewData, bool isSynthesize, ICollection <EventBean> result, ExprEvaluatorContext exprEvaluatorContext)
        {
            if (events == null)
            {
                return;
            }

            var eventsPerStream = new EventBean[1];
            var evaluateParams  = new EvaluateParams(eventsPerStream, isNewData, exprEvaluatorContext);

            foreach (var theEvent in events)
            {
                eventsPerStream[0] = theEvent;

                if (InstrumentationHelper.ENABLED)
                {
                    InstrumentationHelper.Get().QHavingClauseNonJoin(theEvent);
                }
                var passesHaving = havingNode.Evaluate(evaluateParams);
                if (InstrumentationHelper.ENABLED)
                {
                    InstrumentationHelper.Get().AHavingClauseNonJoin(passesHaving.AsBoxedBoolean());
                }
                if ((passesHaving == null) || (false.Equals(passesHaving)))
                {
                    continue;
                }

                var resultEvent = exprProcessor.Process(eventsPerStream, isNewData, isSynthesize, exprEvaluatorContext);
                if (resultEvent != null)
                {
                    result.Add(resultEvent);
                }
            }
        }
Esempio n. 8
0
        private static SelectExprProcessor GetProcessorInternal(ICollection <int> assignedTypeNumberStack, SelectClauseElementCompiled[] selectionList, bool isUsingWildcard, InsertIntoDesc insertIntoDesc, EventType optionalInsertIntoEventType, StreamTypeService typeService, EventAdapterService eventAdapterService, ValueAddEventService valueAddEventService, SelectExprEventTypeRegistry selectExprEventTypeRegistry, EngineImportService engineImportService, int statementId, Attribute[] annotations, ConfigurationInformation configuration, NamedWindowMgmtService namedWindowMgmtService, TableService tableService, GroupByRollupInfo groupByRollupInfo)
        {
            // Wildcard not allowed when insert into specifies column order
            if (isUsingWildcard && insertIntoDesc != null && !insertIntoDesc.ColumnNames.IsEmpty())
            {
                throw new ExprValidationException("Wildcard not allowed when insert-into specifies column order");
            }

            // Determine wildcard processor (select *)
            if (IsWildcardsOnly(selectionList))
            {
                // For joins
                if (typeService.StreamNames.Length > 1)
                {
                    Log.Debug(".getProcessor Using SelectExprJoinWildcardProcessor");
                    return(SelectExprJoinWildcardProcessorFactory.Create(
                               assignedTypeNumberStack, statementId, typeService.StreamNames, typeService.EventTypes,
                               eventAdapterService, insertIntoDesc, selectExprEventTypeRegistry, engineImportService,
                               annotations, configuration, tableService));
                }
                // Single-table selects with no insert-into
                // don't need extra processing
                else if (insertIntoDesc == null)
                {
                    Log.Debug(".getProcessor Using wildcard processor");
                    if (typeService.HasTableTypes)
                    {
                        var tableName = TableServiceUtil.GetTableNameFromEventType(typeService.EventTypes[0]);
                        return(new SelectExprWildcardTableProcessor(tableName, tableService));
                    }
                    return(new SelectExprWildcardProcessor(typeService.EventTypes[0]));
                }
            }

            // Verify the assigned or name used is unique
            if (insertIntoDesc == null)
            {
                VerifyNameUniqueness(selectionList);
            }

            // Construct processor
            var buckets = GetSelectExpressionBuckets(selectionList);

            var factory = new SelectExprProcessorHelper(
                assignedTypeNumberStack, buckets.Expressions, buckets.SelectedStreams, insertIntoDesc,
                optionalInsertIntoEventType, isUsingWildcard, typeService, eventAdapterService, valueAddEventService,
                selectExprEventTypeRegistry, engineImportService, statementId, annotations, configuration,
                namedWindowMgmtService, tableService, groupByRollupInfo);
            SelectExprProcessor processor = factory.Evaluator;

            // add reference to the type obtained
            var type = (EventTypeSPI)processor.ResultEventType;

            if (!typeService.IsOnDemandStreams && type.Metadata.TypeClass != TypeClass.ANONYMOUS)
            {
                selectExprEventTypeRegistry.Add(processor.ResultEventType);
            }
            return(processor);
        }
Esempio n. 9
0
 /// <summary>Ctor. </summary>
 /// <param name="statementResultService">for awareness of listeners and subscribers handles output results</param>
 /// <param name="syntheticProcessor">is the processor generating synthetic events according to the select clause</param>
 /// <param name="bindProcessor">for generating natural object column results</param>
 public SelectExprResultProcessor(StatementResultService statementResultService,
                                  SelectExprProcessor syntheticProcessor,
                                  BindProcessor bindProcessor)
 {
     _statementResultService = statementResultService;
     _syntheticProcessor     = syntheticProcessor;
     _bindProcessor          = bindProcessor;
 }
Esempio n. 10
0
        public void SetUp()
        {
            var selectExprEventTypeRegistry = new SelectExprEventTypeRegistry("abc", new StatementEventTypeRefImpl());
            var supportTypes = new SupportStreamTypeSvc3Stream();

            _processor = SelectExprJoinWildcardProcessorFactory.Create(Collections.GetEmptyList <int>(), 1, "stmtname", supportTypes.StreamNames, supportTypes.EventTypes,
                                                                       SupportEventAdapterService.Service, null, selectExprEventTypeRegistry, null, null, new Configuration(), new TableServiceImpl(), "default");
        }
Esempio n. 11
0
 public EvalInsertWildcardJoinRevision(SelectExprContext selectExprContext,
                                       EventType resultEventType,
                                       SelectExprProcessor joinWildcardProcessor,
                                       ValueAddEventProcessor vaeProcessor)
     : base(selectExprContext, resultEventType)
 {
     _joinWildcardProcessor = joinWildcardProcessor;
     _vaeProcessor          = vaeProcessor;
 }
Esempio n. 12
0
 public ResultSetProcessorAggregateAll(ResultSetProcessorAggregateAllFactory prototype, SelectExprProcessor selectExprProcessor, OrderByProcessor orderByProcessor, AggregationService aggregationService, ExprEvaluatorContext exprEvaluatorContext)
 {
     _prototype             = prototype;
     _selectExprProcessor   = selectExprProcessor;
     _orderByProcessor      = orderByProcessor;
     _aggregationService    = aggregationService;
     _exprEvaluatorContext  = exprEvaluatorContext;
     _outputLastUnordHelper = prototype.IsOutputLast ? new ResultSetProcessorAggregateAllOutputLastHelper(this) : null;
     _outputAllUnordHelper  = prototype.IsOutputAll ? new ResultSetProcessorAggregateAllOutputAllHelper(this) : null;
 }
 public SelectExprJoinWildcardProcessorTableRows(EventType[] types, SelectExprProcessor inner, TableService tableService)
 {
     _inner = inner;
     _eventsPerStreamWTableRows = new EventBean[types.Length];
     _tables = new TableMetadata[types.Length];
     for (int i = 0; i < types.Length; i++)
     {
         _tables[i] = tableService.GetTableMetadataFromEventType(types[i]);
     }
 }
 /// <summary>Ctor. </summary>
 /// <param name="selectExprProcessor">for processing the select expression and generting the readonly output rows</param>
 /// <param name="optionalHavingNode">having clause expression node</param>
 /// <param name="isSelectRStream">true if remove stream events should be generated</param>
 public ResultSetProcessorSimpleFactory(
     SelectExprProcessor selectExprProcessor,
     ExprEvaluator optionalHavingNode,
     bool isSelectRStream,
     OutputLimitSpec outputLimitSpec)
 {
     _selectExprProcessor = selectExprProcessor;
     _optionalHavingExpr  = optionalHavingNode;
     _isSelectRStream     = isSelectRStream;
     _outputLimitSpec     = outputLimitSpec;
 }
Esempio n. 15
0
        /// <summary>
        /// Applies the select-clause to the given events returning the selected events. The number of events stays
        /// the same, i.e. this method does not filter e just transforms the result set.
        /// <para/>
        /// Also applies a having clause.
        /// </summary>
        /// <param name="exprProcessor">processes each input event and returns output event</param>
        /// <param name="events">input events</param>
        /// <param name="havingNode">supplies the having-clause expression</param>
        /// <param name="isNewData">indicates whether we are dealing with new data (istream) or old data (rstream)</param>
        /// <param name="isSynthesize">set to true to indicate that synthetic events are required for an iterator result set</param>
        /// <param name="exprEvaluatorContext">context for expression evalauation</param>
        /// <returns>output events, one for each input event</returns>
        internal static EventBean[] GetSelectEventsHaving(SelectExprProcessor exprProcessor,
                                                          EventBean[] events,
                                                          ExprEvaluator havingNode,
                                                          bool isNewData,
                                                          bool isSynthesize,
                                                          ExprEvaluatorContext exprEvaluatorContext)
        {
            if (events == null)
            {
                return(null);
            }

            ArrayDeque <EventBean> result = null;
            var eventsPerStream           = new EventBean[1];
            var evaluateParams            = new EvaluateParams(eventsPerStream, isNewData, exprEvaluatorContext);

            foreach (var theEvent in events)
            {
                eventsPerStream[0] = theEvent;

                if (InstrumentationHelper.ENABLED)
                {
                    InstrumentationHelper.Get().QHavingClauseNonJoin(theEvent);
                }
                var passesHaving = havingNode.Evaluate(evaluateParams);
                if (InstrumentationHelper.ENABLED)
                {
                    InstrumentationHelper.Get().AHavingClauseNonJoin(passesHaving.AsBoxedBoolean());
                }
                if ((passesHaving == null) || (false.Equals(passesHaving)))
                {
                    continue;
                }

                var generated = exprProcessor.Process(eventsPerStream, isNewData, isSynthesize, exprEvaluatorContext);
                if (generated != null)
                {
                    if (result == null)
                    {
                        result = new ArrayDeque <EventBean>(events.Length);
                    }
                    result.Add(generated);
                }
            }

            if (result != null)
            {
                return(result.ToArray());
            }
            return(null);
        }
Esempio n. 16
0
        public InfraOnMergeActionIns(
            ExprEvaluator optionalFilter,
            SelectExprProcessor insertHelper,
            Table insertIntoTable,
            bool audit,
            bool route)
            : base(optionalFilter)

        {
            this.insertHelper = insertHelper;
            this.insertIntoTable = insertIntoTable;
            this.audit = audit;
            this.route = route;
        }
 public ResultSetProcessorAggregateAll(
     ResultSetProcessorAggregateAllFactory prototype,
     SelectExprProcessor selectExprProcessor,
     OrderByProcessor orderByProcessor,
     AggregationService aggregationService,
     AgentInstanceContext agentInstanceContext)
 {
     _prototype             = prototype;
     _selectExprProcessor   = selectExprProcessor;
     _orderByProcessor      = orderByProcessor;
     _aggregationService    = aggregationService;
     _exprEvaluatorContext  = agentInstanceContext;
     _outputLastUnordHelper = prototype.IsEnableOutputLimitOpt && prototype.IsOutputLast ? prototype.ResultSetProcessorHelperFactory.MakeRSAggregateAllOutputLast(this, agentInstanceContext) : null;
     _outputAllUnordHelper  = prototype.IsEnableOutputLimitOpt && prototype.IsOutputAll ? prototype.ResultSetProcessorHelperFactory.MakeRSAggregateAllOutputAll(this, agentInstanceContext) : null;
 }
Esempio n. 18
0
 /// <summary>
 /// Ctor.
 /// </summary>
 /// <param name="selectExprProcessor">for processing the select expression and generting the readonly output rows</param>
 /// <param name="optionalHavingNode">having clause expression node</param>
 /// <param name="isSelectRStream">true if remove stream events should be generated</param>
 /// <param name="isUnidirectional">true if unidirectional join</param>
 /// <param name="isHistoricalOnly">if set to <c>true</c> [is historical only].</param>
 public ResultSetProcessorRowForAllFactory(
     SelectExprProcessor selectExprProcessor,
     ExprEvaluator optionalHavingNode,
     bool isSelectRStream,
     bool isUnidirectional,
     bool isHistoricalOnly,
     OutputLimitSpec outputLimitSpec)
 {
     _selectExprProcessor = selectExprProcessor;
     OutputLimitSpec      = outputLimitSpec;
     OptionalHavingNode   = optionalHavingNode;
     IsSelectRStream      = isSelectRStream;
     IsUnidirectional     = isUnidirectional;
     IsHistoricalOnly     = isHistoricalOnly;
 }
Esempio n. 19
0
        /// <summary>
        /// Applies the select-clause to the given events returning the selected events. The number of events stays the
        /// same, i.e. this method does not filter e just transforms the result set. <para/>Also applies a having clause.
        /// </summary>
        /// <param name="exprProcessor">processes each input event and returns output event</param>
        /// <param name="orderByProcessor">for sorting output events according to the order-by clause</param>
        /// <param name="events">input events</param>
        /// <param name="havingNode">supplies the having-clause expression</param>
        /// <param name="isNewData">indicates whether we are dealing with new data (istream) or old data (rstream)</param>
        /// <param name="isSynthesize">set to true to indicate that synthetic events are required for an iterator result set</param>
        /// <param name="exprEvaluatorContext">context for expression evalauation</param>
        /// <returns>output events, one for each input event</returns>
        internal static EventBean[] GetSelectJoinEventsHavingWithOrderBy(SelectExprProcessor exprProcessor, OrderByProcessor orderByProcessor, ICollection <MultiKey <EventBean> > events, ExprEvaluator havingNode, bool isNewData, bool isSynthesize, ExprEvaluatorContext exprEvaluatorContext)
        {
            if ((events == null) || (events.IsEmpty()))
            {
                return(null);
            }

            ArrayDeque <EventBean>   result          = null;
            ArrayDeque <EventBean[]> eventGenerators = null;

            foreach (var key in events)
            {
                var eventsPerStream = key.Array;

                if (InstrumentationHelper.ENABLED)
                {
                    InstrumentationHelper.Get().QHavingClauseJoin(eventsPerStream);
                }
                var evaluateParams = new EvaluateParams(eventsPerStream, isNewData, exprEvaluatorContext);
                var passesHaving   = havingNode.Evaluate(evaluateParams);
                if (InstrumentationHelper.ENABLED)
                {
                    InstrumentationHelper.Get().AHavingClauseJoin(passesHaving.AsBoxedBoolean());
                }
                if ((passesHaving == null) || (false.Equals(passesHaving)))
                {
                    continue;
                }

                var resultEvent = exprProcessor.Process(eventsPerStream, isNewData, isSynthesize, exprEvaluatorContext);
                if (resultEvent != null)
                {
                    if (result == null)
                    {
                        result          = new ArrayDeque <EventBean>(events.Count);
                        eventGenerators = new ArrayDeque <EventBean[]>(events.Count);
                    }
                    result.Add(resultEvent);
                    eventGenerators.Add(eventsPerStream);
                }
            }

            if (result != null)
            {
                return(orderByProcessor.Sort(result.ToArray(), eventGenerators.ToArray(), isNewData, exprEvaluatorContext));
            }
            return(null);
        }
 public ResultSetProcessorRowForAll(ResultSetProcessorRowForAllFactory prototype, SelectExprProcessor selectExprProcessor, OrderByProcessor orderByProcessor, AggregationService aggregationService, ExprEvaluatorContext exprEvaluatorContext)
 {
     this.Prototype            = prototype;
     _selectExprProcessor      = selectExprProcessor;
     _orderByProcessor         = orderByProcessor;
     this.AggregationService   = aggregationService;
     this.ExprEvaluatorContext = exprEvaluatorContext;
     if (prototype.IsOutputLast)
     {
         _outputLastHelper = new ResultSetProcessorRowForAllOutputLastHelper(this);
     }
     else if (prototype.IsOutputAll)
     {
         _outputAllHelper = new ResultSetProcessorRowForAllOutputAllHelper(this);
     }
 }
Esempio n. 21
0
 /// <summary>
 /// Ctor.
 /// </summary>
 /// <param name="selectExprProcessor">for processing the select expression and generting the readonly output rows</param>
 /// <param name="optionalHavingNode">having clause expression node</param>
 /// <param name="isSelectRStream">true if remove stream events should be generated</param>
 /// <param name="outputLimitSpec">The output limit spec.</param>
 /// <param name="enableOutputLimitOpt">if set to <c>true</c> [enable output limit opt].</param>
 /// <param name="resultSetProcessorHelperFactory">The result set processor helper factory.</param>
 /// <param name="numStreams">The number streams.</param>
 public ResultSetProcessorSimpleFactory(
     SelectExprProcessor selectExprProcessor,
     ExprEvaluator optionalHavingNode,
     bool isSelectRStream,
     OutputLimitSpec outputLimitSpec,
     bool enableOutputLimitOpt,
     ResultSetProcessorHelperFactory resultSetProcessorHelperFactory,
     int numStreams)
 {
     _selectExprProcessor            = selectExprProcessor;
     _optionalHavingExpr             = optionalHavingNode;
     _isSelectRStream                = isSelectRStream;
     _outputLimitSpec                = outputLimitSpec;
     IsEnableOutputLimitOpt          = enableOutputLimitOpt;
     ResultSetProcessorHelperFactory = resultSetProcessorHelperFactory;
     NumStreams = numStreams;
 }
Esempio n. 22
0
        /// <summary>
        /// Applies the select-clause to the given events returning the selected events. The number of
        /// events stays the same, i.e. this method does not filter e just transforms the result set.
        /// </summary>
        /// <param name="exprProcessor">processes each input event and returns output event</param>
        /// <param name="events">input events</param>
        /// <param name="isNewData">indicates whether we are dealing with new data (istream) or old data (rstream)</param>
        /// <param name="isSynthesize">set to true to indicate that synthetic events are required for an iterator result set</param>
        /// <param name="exprEvaluatorContext">context for expression evalauation</param>
        /// <returns>output events, one for each input event</returns>
        internal static EventBean[] GetSelectEventsNoHaving(SelectExprProcessor exprProcessor, EventBean[] events, bool isNewData, bool isSynthesize, ExprEvaluatorContext exprEvaluatorContext)
        {
            if (events == null)
            {
                return(null);
            }

            var result          = new EventBean[events.Length];
            var eventsPerStream = new EventBean[1];

            for (var i = 0; i < events.Length; i++)
            {
                eventsPerStream[0] = events[i];
                result[i]          = exprProcessor.Process(eventsPerStream, isNewData, isSynthesize, exprEvaluatorContext);
            }
            return(result);
        }
Esempio n. 23
0
 public TableOnMergeActionIns(
     ExprEvaluator optionalFilter,
     SelectExprProcessor insertHelper,
     InternalEventRouter internalEventRouter,
     EPStatementHandle statementHandle,
     InternalEventRouteDest internalEventRouteDest,
     bool audit,
     TableStateRowFactory tableStateRowFactory)
     : base(optionalFilter)
 {
     _insertHelper           = insertHelper;
     _internalEventRouter    = internalEventRouter;
     _statementHandle        = statementHandle;
     _internalEventRouteDest = internalEventRouteDest;
     _audit = audit;
     _tableStateRowFactory = tableStateRowFactory;
 }
Esempio n. 24
0
        internal static void PopulateSelectJoinEventsNoHaving(SelectExprProcessor exprProcessor, ICollection <MultiKey <EventBean> > events, bool isNewData, bool isSynthesize, ICollection <EventBean> result, ExprEvaluatorContext exprEvaluatorContext)
        {
            var length = (events != null) ? events.Count : 0;

            if (length == 0)
            {
                return;
            }

            foreach (var key in events)
            {
                var eventsPerStream = key.Array;
                var resultEvent     = exprProcessor.Process(eventsPerStream, isNewData, isSynthesize, exprEvaluatorContext);
                if (resultEvent != null)
                {
                    result.Add(resultEvent);
                }
            }
        }
Esempio n. 25
0
 public NamedWindowOnMergeActionIns(
     ExprEvaluator optionalFilter,
     SelectExprProcessor insertHelper,
     InternalEventRouter internalEventRouter,
     String insertIntoTableName,
     TableService tableService,
     EPStatementHandle statementHandle,
     InternalEventRouteDest internalEventRouteDest,
     bool audit)
     : base(optionalFilter)
 {
     _insertHelper           = insertHelper;
     _internalEventRouter    = internalEventRouter;
     _insertIntoTableName    = insertIntoTableName;
     _tableService           = tableService;
     _statementHandle        = statementHandle;
     _internalEventRouteDest = internalEventRouteDest;
     _audit = audit;
 }
Esempio n. 26
0
 public ResultSetProcessorSimple(
     ResultSetProcessorSimpleFactory prototype,
     SelectExprProcessor selectExprProcessor,
     OrderByProcessor orderByProcessor,
     ExprEvaluatorContext exprEvaluatorContext)
 {
     Prototype            = prototype;
     _selectExprProcessor = selectExprProcessor;
     _orderByProcessor    = orderByProcessor;
     ExprEvaluatorContext = exprEvaluatorContext;
     if (prototype.IsOutputLast)
     {
         _outputLastHelper = new ResultSetProcessorSimpleOutputLastHelper(this);
     }
     else if (prototype.IsOutputAll)
     {
         _outputAllHelper = new ResultSetProcessorSimpleOutputAllHelper(this);
     }
 }
Esempio n. 27
0
        /// <summary>
        /// Applies the select-clause to the given events returning the selected events. The number of events stays the
        /// same, i.e. this method does not filter e just transforms the result set.
        /// </summary>
        /// <param name="exprProcessor">processes each input event and returns output event</param>
        /// <param name="events">input events</param>
        /// <param name="isNewData">indicates whether we are dealing with new data (istream) or old data (rstream)</param>
        /// <param name="isSynthesize">set to true to indicate that synthetic events are required for an iterator result set</param>
        /// <param name="exprEvaluatorContext">context for expression evalauation</param>
        /// <returns>output events, one for each input event</returns>
        internal static EventBean[] GetSelectJoinEventsNoHaving(SelectExprProcessor exprProcessor, ICollection <MultiKey <EventBean> > events, bool isNewData, bool isSynthesize, ExprEvaluatorContext exprEvaluatorContext)
        {
            if ((events == null) || (events.IsEmpty()))
            {
                return(null);
            }

            var result = new EventBean[events.Count];
            var count  = 0;

            foreach (var key in events)
            {
                var eventsPerStream = key.Array;
                result[count] = exprProcessor.Process(eventsPerStream, isNewData, isSynthesize, exprEvaluatorContext);
                count++;
            }

            return(result);
        }
        public void SetUp()
        {
            var selectExprEventTypeRegistry = new SelectExprEventTypeRegistry("abc", new StatementEventTypeRefImpl());
            var statementContext            = SupportStatementContextFactory.MakeContext();

            var factory = new SelectExprProcessorHelper(
                Collections.GetEmptyList <int>(), SupportSelectExprFactory.MakeNoAggregateSelectList(),
                Collections.GetEmptyList <SelectExprStreamDesc>(), null, null, false,
                new SupportStreamTypeSvc1Stream(), SupportEventAdapterService.Service, null,
                selectExprEventTypeRegistry, statementContext.EngineImportService, 1, "stmtname", null,
                new Configuration(), null, new TableServiceImpl(), null);

            _selectExprProcessor = factory.Evaluator;
            _orderByProcessor    = null;

            var prototype = new ResultSetProcessorSimpleFactory(_selectExprProcessor, null, true, null, false, null, 1);

            _outputProcessorAll = (ResultSetProcessorSimple)prototype.Instantiate(null, null, null);
        }
 /// <summary>
 /// Ctor.
 /// </summary>
 /// <param name="selectExprProcessor">for processing the select expression and generting the readonly output rows</param>
 /// <param name="optionalHavingNode">having clause expression node</param>
 /// <param name="isSelectRStream">true if remove stream events should be generated</param>
 /// <param name="isUnidirectional">true if unidirectional join</param>
 /// <param name="isHistoricalOnly">if set to <c>true</c> [is historical only].</param>
 /// <param name="outputLimitSpec">The output limit spec.</param>
 /// <param name="enableOutputLimitOpt">if set to <c>true</c> [enable output limit opt].</param>
 /// <param name="resultSetProcessorHelperFactory">The result set processor helper factory.</param>
 public ResultSetProcessorAggregateAllFactory(
     SelectExprProcessor selectExprProcessor,
     ExprEvaluator optionalHavingNode,
     bool isSelectRStream,
     bool isUnidirectional,
     bool isHistoricalOnly,
     OutputLimitSpec outputLimitSpec,
     bool enableOutputLimitOpt,
     ResultSetProcessorHelperFactory resultSetProcessorHelperFactory)
 {
     _selectExprProcessor            = selectExprProcessor;
     OutputLimitSpec                 = outputLimitSpec;
     OptionalHavingNode              = optionalHavingNode;
     IsSelectRStream                 = isSelectRStream;
     IsUnidirectional                = isUnidirectional;
     IsHistoricalOnly                = isHistoricalOnly;
     IsEnableOutputLimitOpt          = enableOutputLimitOpt;
     ResultSetProcessorHelperFactory = resultSetProcessorHelperFactory;
 }
Esempio n. 30
0
        internal static void PopulateSelectEventsNoHaving(SelectExprProcessor exprProcessor, EventBean[] events, bool isNewData, bool isSynthesize, ICollection <EventBean> result, ExprEvaluatorContext exprEvaluatorContext)
        {
            if (events == null)
            {
                return;
            }

            var eventsPerStream = new EventBean[1];

            foreach (var theEvent in events)
            {
                eventsPerStream[0] = theEvent;

                var resultEvent = exprProcessor.Process(eventsPerStream, isNewData, isSynthesize, exprEvaluatorContext);
                if (resultEvent != null)
                {
                    result.Add(resultEvent);
                }
            }
        }