Ejemplo n.º 1
0
        /// <summary>
        /// Recursive method to run through all child nodes and, for each result set tuple returned
        /// by a child node, execute the inner child of the child node until there are no inner child nodes.
        /// </summary>
        /// <param name="lookupEvent">current event to use for lookup by child node</param>
        /// <param name="nestingOrderIndex">index within the child nodes indicating what nesting level we are at</param>
        /// <param name="currentPath">prototype result row to use by child nodes for generating result rows</param>
        /// <param name="result">result tuple rows to be populated</param>
        /// <param name="exprEvaluatorContext">context for expression evalauation</param>
        protected void RecursiveNestedJoin(
            EventBean lookupEvent,
            int nestingOrderIndex,
            EventBean[] currentPath,
            ICollection<EventBean[]> result,
            ExprEvaluatorContext exprEvaluatorContext)
        {
            IList<EventBean[]> nestedResult = new List<EventBean[]>();
            ExecNode nestedExecNode = childNodes[nestingOrderIndex];
            nestedExecNode.Process(lookupEvent, currentPath, nestedResult, exprEvaluatorContext);
            bool isLastStream = nestingOrderIndex == nestingOrderLength - 1;

            // This is not the last nesting level so no result rows are added. Invoke next nesting level for
            // each event found.
            if (!isLastStream) {
                foreach (EventBean[] row in nestedResult) {
                    EventBean lookup = row[nestedStreams[nestingOrderIndex]];
                    RecursiveNestedJoin(lookup, nestingOrderIndex + 1, row, result, exprEvaluatorContext);
                }

                return;
            }

            // Loop to add result rows
            foreach (EventBean[] row in nestedResult) {
                result.Add(row);
            }
        }
Ejemplo n.º 2
0
        public void Lookup(EventBean[] lookupEvents, ICollection <MultiKey <EventBean> > joinSet, ExprEvaluatorContext exprEvaluatorContext)
        {
            if ((lookupEvents != null) && (lookupEvents.Length != 0))
            {
                unchecked
                {
                    var results = new List <EventBean[]>();
                    int count   = lookupEvents.Length;
                    for (int ii = 0; ii < count; ii++)
                    {
                        var theEvent  = lookupEvents[ii];
                        var prototype = new EventBean[NumStreams];

                        // Set up _prototype row
                        prototype[ForStream] = theEvent;

                        // Perform execution
                        ExecNode.Process(theEvent, prototype, results, exprEvaluatorContext);

                        // Convert results into unique set
                        results.ForEach(row => joinSet.Add(new MultiKey <EventBean>(row)));
                        results.Clear();
                    }
                }
            }
        }