Пример #1
0
 public override void ProcessWindow()
 {
     if (WatermarkA > WindowStart.Add(GetWindowSize()) && WatermarkB > WindowStart.Add(GetWindowSize()))
     {
         WindowStart = WindowStart.Add(GetSlideSize());
         RemoveOutsideWindowData(WindowStart);
     }
 }
Пример #2
0
 public override void ProcessWindow(List <Data <T> > inputs, DateTime watermark)
 {
     if (watermark > WindowStart.Add(GetWindowSize()))
     {
         var groups = inputs.Where(x => ExtractTimestamp(x) < WindowStart.Add(GetWindowSize())).GroupBy(x => x.Key);
         foreach (var group in groups)
         {
             var content = group.Select(x => x.Value).ToList();
             SendToNextStreamData(group.Key, new Data <K>(group.Key, Aggregate(content)), GetMetadata());
         }
         WindowStart = WindowStart.Add(GetSlideSize());
         RemoveOutsideWindowData(WindowStart);
     }
 }
Пример #3
0
        public override void ProcessData(Data <T> input, Metadata metadata)
        {
            if (WindowStart == DateTime.MinValue)
            {
                WindowStart = ExtractTimestamp(input);
            }
            if (WatermarkA.Subtract(AllowedLateness()) <= ExtractTimestamp(input))
            {
                sourceAInput.Add(input);
                if (ExtractTimestamp(input) < WindowStart.Add(GetWindowSize()))
                {
                    var sourceBWithSameKey = sourceBInput.Where(x => x.Key.Equals(input.Key) && (ExtractTimestamp(x) < WindowStart.Add(GetWindowSize()))).ToList();

                    foreach (var bIn in sourceBWithSameKey)
                    {
                        var dt = new Data <(T, K)>(input.Key, (input.Value, bIn.Value));
                        SendToNextStreamData(input.Key, dt, GetMetadata());
                    }
                }
            }
        }