/** * Windows this {@code KeyedStream} into tumbling count windows. * * @param size The size of the windows in number of elements. */ public WindowedStream<T, KEY, GlobalWindow> countWindow(long size) { return window(GlobalWindows.create()).trigger(PurgingTrigger.of(CountTrigger.of(size))); }
/** * Creates a new {@code GlobalWindows} {@link WindowAssigner} that assigns * all elements to the same {@link GlobalWindow}. * * @return The global window policy. */ public static GlobalWindows create() { return new GlobalWindows(); }
@Test public void testWindowAssignment() { WindowAssigner.WindowAssignerContext mockContext = mock(WindowAssigner.WindowAssignerContext.class); GlobalWindows assigner = GlobalWindows.create(); assertThat(assigner.assignWindows("String", 0L, mockContext), contains(GlobalWindow.get())); assertThat(assigner.assignWindows("String", 4999L, mockContext), contains(GlobalWindow.get())); assertThat(assigner.assignWindows("String", 5000L, mockContext), contains(GlobalWindow.get())); }
@Test public void testProperties() { GlobalWindows assigner = GlobalWindows.create(); assertFalse(assigner.isEventTime()); assertEquals(new GlobalWindow.Serializer(), assigner.getWindowSerializer(new ExecutionConfig())); assertThat(assigner.getDefaultTrigger(mock(StreamExecutionEnvironment.class)), instanceOf(GlobalWindows.NeverTrigger.class)); } }
/** * Windows this {@code DataStream} into tumbling count windows. * * <p>Note: This operation is inherently non-parallel since all elements have to pass through * the same operator instance. * * @param size The size of the windows in number of elements. */ public AllWindowedStream<T, GlobalWindow> countWindowAll(long size) { return windowAll(GlobalWindows.create()).trigger(PurgingTrigger.of(CountTrigger.of(size))); }
/** * Creates a new {@code GlobalWindows} {@link WindowAssigner} that assigns * all elements to the same {@link GlobalWindow}. * * @return The global window policy. */ public static GlobalWindows create() { return new GlobalWindows(); }
/** * Windows this {@code KeyedStream} into sliding count windows. * * @param size The size of the windows in number of elements. * @param slide The slide interval in number of elements. */ public WindowedStream<T, KEY, GlobalWindow> countWindow(long size, long slide) { return window(GlobalWindows.create()) .evictor(CountEvictor.of(size)) .trigger(CountTrigger.of(slide)); }
/** * Creates a new {@code GlobalWindows} {@link WindowAssigner} that assigns * all elements to the same {@link GlobalWindow}. * * @return The global window policy. */ public static GlobalWindows create() { return new GlobalWindows(); }
/** * Windows this {@code DataStream} into sliding count windows. * * <p>Note: This operation is inherently non-parallel since all elements have to pass through * the same operator instance. * * @param size The size of the windows in number of elements. * @param slide The slide interval in number of elements. */ public AllWindowedStream<T, GlobalWindow> countWindowAll(long size, long slide) { return windowAll(GlobalWindows.create()) .evictor(CountEvictor.of(size)) .trigger(CountTrigger.of(slide)); }
/** * Creates a new {@code GlobalWindows} {@link WindowAssigner} that assigns * all elements to the same {@link GlobalWindow}. * * @return The global window policy. */ public static GlobalWindows create() { return new GlobalWindows(); }
.assignTimestampsAndWatermarks(new CarTimestamp()) .keyBy(0) .window(GlobalWindows.create()) .evictor(TimeEvictor.of(Time.of(evictionSec, TimeUnit.SECONDS))) .trigger(DeltaTrigger.of(triggerMeters,
.windowAll(GlobalWindows.create()) .trigger(PurgingTrigger.of(CountTrigger.of(5))) .apply(new AllWindowFunction<Tuple2<Integer, String>, String, GlobalWindow>() { .windowAll(GlobalWindows.create()) .trigger(PurgingTrigger.of(CountTrigger.of(5))) .fold(new CustomPOJO(), new FoldFunction<String, CustomPOJO>() {
.windowAll(GlobalWindows.create()) .trigger(PurgingTrigger.of(CountTrigger.of(10))) .fold(0L, new FoldFunction<Long, Long>() {
GlobalWindows.create(), new GlobalWindow.Serializer(), new TupleKeySelector(),
GlobalWindows.create(), new GlobalWindow.Serializer(), new TupleKeySelector(),
GlobalWindows.create(), new GlobalWindow.Serializer(), new TupleKeySelector(),
GlobalWindows.create(), new GlobalWindow.Serializer(), new TupleKeySelector(),
GlobalWindows.create(), new GlobalWindow.Serializer(), new TupleKeySelector(),
GlobalWindows.create(), new GlobalWindow.Serializer(), new TupleKeySelector(),
GlobalWindows.create(), new GlobalWindow.Serializer(), new TupleKeySelector(),