示例#1
0
 public override string[][] GetUniqueIndexes(FireAndForgetInstance processorInstance)
 {
     if (processorInstance == null)
     {
         return(new string[0][]);
     }
     return(_namedWindowProcessor.UniqueIndexes);
 }
示例#2
0
        private ICollection <EventBean> GetStreamSnapshotInstance(
            int streamNum,
            IList <ExprNode> filterExpressions,
            FireAndForgetInstance processorInstance)
        {
            var coll = processorInstance.SnapshotBestEffort(this, _filters[streamNum], _statementSpec.Annotations);

            if (filterExpressions.Count != 0)
            {
                coll = GetFiltered(coll, filterExpressions);
            }
            return(coll);
        }
示例#3
0
 public abstract string[][] GetUniqueIndexes(FireAndForgetInstance processorInstance);
 public EventBean[] Execute(FireAndForgetInstance fireAndForgetProcessorInstance)
 {
     return(fireAndForgetProcessorInstance.ProcessInsert(this));
 }
        /// <summary>
        /// Executes the prepared query.
        /// </summary>
        /// <returns>query results</returns>
        public EPPreparedQueryResult Execute(ContextPartitionSelector[] contextPartitionSelectors)
        {
            try {
                if (contextPartitionSelectors != null && contextPartitionSelectors.Length != 1)
                {
                    throw new ArgumentException("Number of context partition selectors must be one");
                }
                var optionalSingleSelector = contextPartitionSelectors != null && contextPartitionSelectors.Length > 0 ? contextPartitionSelectors[0] : null;

                // validate context
                if (Processor.ContextName != null &&
                    StatementSpec.OptionalContextName != null &&
                    !Processor.ContextName.Equals(StatementSpec.OptionalContextName))
                {
                    throw new EPException("Context for named window is '" + Processor.ContextName + "' and query specifies context '" + StatementSpec.OptionalContextName + "'");
                }

                // handle non-specified context
                if (StatementSpec.OptionalContextName == null)
                {
                    FireAndForgetInstance processorInstance = Processor.GetProcessorInstanceNoContext();
                    if (processorInstance != null)
                    {
                        var rows = Executor.Execute(processorInstance);
                        if (rows != null && rows.Length > 0)
                        {
                            Dispatch();
                        }
                        return(new EPPreparedQueryResult(Processor.EventTypePublic, rows));
                    }
                }

                // context partition runtime query
                var agentInstanceIds = EPPreparedExecuteMethodHelper.GetAgentInstanceIds(Processor, optionalSingleSelector, Services.ContextManagementService, Processor.ContextName);

                // collect events and agent instances
                if (agentInstanceIds.IsEmpty())
                {
                    return(new EPPreparedQueryResult(Processor.EventTypeResultSetProcessor, CollectionUtil.EVENTBEANARRAY_EMPTY));
                }

                if (agentInstanceIds.Count == 1)
                {
                    int agentInstanceId   = agentInstanceIds.First();
                    var processorInstance = Processor.GetProcessorInstanceContextById(agentInstanceId);
                    var rows = Executor.Execute(processorInstance);
                    if (rows.Length > 0)
                    {
                        Dispatch();
                    }
                    return(new EPPreparedQueryResult(Processor.EventTypeResultSetProcessor, rows));
                }

                var allRows = new ArrayDeque <EventBean>();
                foreach (int agentInstanceId in agentInstanceIds)
                {
                    var processorInstance = Processor.GetProcessorInstanceContextById(agentInstanceId);
                    if (processorInstance != null)
                    {
                        var rows = Executor.Execute(processorInstance);
                        allRows.AddAll(rows);
                    }
                }
                if (allRows.Count > 0)
                {
                    Dispatch();
                }
                return(new EPPreparedQueryResult(Processor.EventTypeResultSetProcessor, allRows.ToArray()));
            }
            finally {
                if (HasTableAccess)
                {
                    Services.TableService.TableExprEvaluatorContext.ReleaseAcquiredLocks();
                }
            }
        }
示例#6
0
 public override string[][] GetUniqueIndexes(FireAndForgetInstance processorInstance)
 {
     return(_tableMetadata.UniqueIndexes);
 }