コード例 #1
0
        public void ProcessJoin(
            ISet<MultiKeyArrayOfKeys<EventBean>> newData,
            ISet<MultiKeyArrayOfKeys<EventBean>> oldData,
            bool isGenerateSynthetic)
        {
            var newDataMultiKey = processor.GenerateGroupKeyArrayJoin(newData, true);
            var oldDataMultiKey = processor.GenerateGroupKeyArrayJoin(oldData, false);

            if (newData != null) {
                // apply new data to aggregates
                var count = 0;
                foreach (var aNewData in newData) {
                    var mk = newDataMultiKey[count];
                    processor.AggregationService.ApplyEnter(aNewData.Array, mk, processor.GetAgentInstanceContext());
                    count++;
                }
            }

            if (oldData != null) {
                // apply old data to aggregates
                var count = 0;
                foreach (var anOldData in oldData) {
                    processor.AggregationService.ApplyLeave(
                        anOldData.Array,
                        oldDataMultiKey[count],
                        processor.GetAgentInstanceContext());
                    count++;
                }
            }

            if (processor.IsSelectRStream) {
                processor.GenerateOutputBatchedJoinPerKey(
                    oldData,
                    oldDataMultiKey,
                    false,
                    isGenerateSynthetic,
                    outputLastUnordGroupOld,
                    null);
            }

            processor.GenerateOutputBatchedJoinPerKey(
                newData,
                newDataMultiKey,
                false,
                isGenerateSynthetic,
                outputLastUnordGroupNew,
                null);
        }
        public void ProcessJoin(
            ISet<MultiKeyArrayOfKeys<EventBean>> newData,
            ISet<MultiKeyArrayOfKeys<EventBean>> oldData,
            bool isGenerateSynthetic)
        {
            var newDataMultiKey = processor.GenerateGroupKeyArrayJoin(newData, true);
            var oldDataMultiKey = processor.GenerateGroupKeyArrayJoin(oldData, false);
            ISet<object> keysSeenRemoved = new HashSet<object>();

            if (newData != null) {
                // apply new data to aggregates
                var count = 0;
                foreach (var aNewData in newData) {
                    var mk = newDataMultiKey[count];
                    repsPerGroup.Put(mk, aNewData.Array);
                    lastSeenKeys.Add(mk);
                    processor.AggregationService.ApplyEnter(aNewData.Array, mk, processor.GetAgentInstanceContext());
                    count++;
                }
            }

            if (oldData != null) {
                // apply old data to aggregates
                var count = 0;
                foreach (var anOldData in oldData) {
                    var mk = oldDataMultiKey[count];
                    lastSeenKeys.Add(mk);
                    keysSeenRemoved.Add(mk);
                    processor.AggregationService.ApplyLeave(
                        anOldData.Array,
                        oldDataMultiKey[count],
                        processor.GetAgentInstanceContext());
                    count++;
                }
            }

            if (processor.IsSelectRStream) {
                processor.GenerateOutputBatchedJoinUnkeyed(
                    oldData,
                    oldDataMultiKey,
                    false,
                    isGenerateSynthetic,
                    eventsOld,
                    null);
            }

            processor.GenerateOutputBatchedJoinUnkeyed(
                newData,
                newDataMultiKey,
                false,
                isGenerateSynthetic,
                eventsNew,
                null);

            foreach (var keySeen in keysSeenRemoved) {
                var newEvent = processor.GenerateOutputBatchedSingle(
                    keySeen,
                    repsPerGroup.Get(keySeen),
                    true,
                    isGenerateSynthetic);
                if (newEvent != null) {
                    eventsNew.Add(newEvent);
                }
            }
        }