public static void Run()
        {
            var env = StreamExecutionEnvironment.GetExecutionEnvironment()
                      .SetStreamTimeCharacteristic(TimeCharacteristic.EventTime)
                      .SetParallelism(1);

            var stream = env.ReadTextFile("").Map(new CarDatumMapper());

            var transformation = stream.AssignTimestampsAndWatermarks(new CarTimestampExtractor())
                                 .KeyBy("Id")
                                 .Window(GlobalWindowAssigner <CarDatum> .Create())
                                 .Evictor(TimeWindowEvictor.Of <CarDatum, GlobalWindow>(TimeSpan.FromSeconds(10)))
                                 .Trigger(DeltaWindowTrigger.Of <CarDatum, GlobalWindow>(50, new CarDeltaFunctor(), null))
                                 .MaxBy(1);

            transformation.Print();

            env.Execute("CarTopSpeedWindowingExample");
        }
Beispiel #2
0
 /// <summary>
 /// Windows this <see cref="DataStream{TElement}"/> into sliding count windows.
 /// Note: This operation is inherently non-parallel since all elements have to pass through the same operator instance.
 /// </summary>
 /// <param name="size">The size of the windows in number of elements.</param>
 /// <param name="slide">The slide interval in number of elements.</param>
 /// <returns></returns>
 public AllWindowedStream <TElement, GlobalWindow> CountWindowAll(long size, long slide) =>
 WindowAll(GlobalWindowAssigner <TElement> .Create())
 .Evictor(CountWindowEvictor.Of <TElement, GlobalWindow>(size))
 .Trigger(CountWindowTrigger.Of <TElement, GlobalWindow>(slide));
Beispiel #3
0
 /// <summary>
 /// Windows this <see cref="DataStream{TElement}"/> into tumbling count windows.
 /// Note: This operation is inherently non-parallel since all elements have to pass through the same operator instance.
 /// </summary>
 /// <param name="size">The size of the windows in number of elements.</param>
 /// <returns></returns>
 public AllWindowedStream <TElement, GlobalWindow> CountWindowAll(long size) =>
 WindowAll(GlobalWindowAssigner <TElement> .Create())
 .Trigger(PurgingWindowTrigger.Of(CountWindowTrigger.Of <TElement, GlobalWindow>(size)));