当前位置: 首页>>代码示例>>Java>>正文


Java EventTimeSessionWindows.mergeWindows方法代码示例

本文整理汇总了Java中org.apache.flink.streaming.api.windowing.assigners.EventTimeSessionWindows.mergeWindows方法的典型用法代码示例。如果您正苦于以下问题:Java EventTimeSessionWindows.mergeWindows方法的具体用法?Java EventTimeSessionWindows.mergeWindows怎么用?Java EventTimeSessionWindows.mergeWindows使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.flink.streaming.api.windowing.assigners.EventTimeSessionWindows的用法示例。


在下文中一共展示了EventTimeSessionWindows.mergeWindows方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testMergeConsecutiveWindows

import org.apache.flink.streaming.api.windowing.assigners.EventTimeSessionWindows; //导入方法依赖的package包/类
@Test
public void testMergeConsecutiveWindows() {
	MergingWindowAssigner.MergeCallback callback = mock(MergingWindowAssigner.MergeCallback.class);

	EventTimeSessionWindows assigner = EventTimeSessionWindows.withGap(Time.milliseconds(5000));

	assigner.mergeWindows(
			Lists.newArrayList(
					new TimeWindow(0, 1),
					new TimeWindow(1, 2),
					new TimeWindow(2, 3),
					new TimeWindow(4, 5),
					new TimeWindow(5, 6)),
			callback);

	verify(callback, times(1)).merge(
			(Collection<TimeWindow>) argThat(containsInAnyOrder(new TimeWindow(0, 1), new TimeWindow(1, 2), new TimeWindow(2, 3))),
			eq(new TimeWindow(0, 3)));

	verify(callback, times(1)).merge(
			(Collection<TimeWindow>) argThat(containsInAnyOrder(new TimeWindow(4, 5), new TimeWindow(5, 6))),
			eq(new TimeWindow(4, 6)));

	verify(callback, times(2)).merge(anyCollection(), Matchers.anyObject());
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:26,代码来源:EventTimeSessionWindowsTest.java

示例2: testMergeCoveringWindow

import org.apache.flink.streaming.api.windowing.assigners.EventTimeSessionWindows; //导入方法依赖的package包/类
@Test
public void testMergeCoveringWindow() {
	MergingWindowAssigner.MergeCallback callback = mock(MergingWindowAssigner.MergeCallback.class);

	EventTimeSessionWindows assigner = EventTimeSessionWindows.withGap(Time.milliseconds(5000));

	assigner.mergeWindows(
			Lists.newArrayList(
					new TimeWindow(1, 1),
					new TimeWindow(0, 2),
					new TimeWindow(4, 7),
					new TimeWindow(5, 6)),
			callback);

	verify(callback, times(1)).merge(
			(Collection<TimeWindow>) argThat(containsInAnyOrder(new TimeWindow(1, 1), new TimeWindow(0, 2))),
			eq(new TimeWindow(0, 2)));

	verify(callback, times(1)).merge(
			(Collection<TimeWindow>) argThat(containsInAnyOrder(new TimeWindow(5, 6), new TimeWindow(4, 7))),
			eq(new TimeWindow(4, 7)));

	verify(callback, times(2)).merge(anyCollection(), Matchers.anyObject());
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:25,代码来源:EventTimeSessionWindowsTest.java

示例3: testMergeSinglePointWindow

import org.apache.flink.streaming.api.windowing.assigners.EventTimeSessionWindows; //导入方法依赖的package包/类
@Test
public void testMergeSinglePointWindow() {
	MergingWindowAssigner.MergeCallback callback = mock(MergingWindowAssigner.MergeCallback.class);

	EventTimeSessionWindows assigner = EventTimeSessionWindows.withGap(Time.milliseconds(5000));

	assigner.mergeWindows(Lists.newArrayList(new TimeWindow(0, 0)), callback);

	verify(callback, never()).merge(anyCollection(), Matchers.anyObject());
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:11,代码来源:EventTimeSessionWindowsTest.java

示例4: testMergeSingleWindow

import org.apache.flink.streaming.api.windowing.assigners.EventTimeSessionWindows; //导入方法依赖的package包/类
@Test
public void testMergeSingleWindow() {
	MergingWindowAssigner.MergeCallback callback = mock(MergingWindowAssigner.MergeCallback.class);

	EventTimeSessionWindows assigner = EventTimeSessionWindows.withGap(Time.milliseconds(5000));

	assigner.mergeWindows(Lists.newArrayList(new TimeWindow(0, 1)), callback);

	verify(callback, never()).merge(anyCollection(), Matchers.anyObject());
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:11,代码来源:EventTimeSessionWindowsTest.java


注:本文中的org.apache.flink.streaming.api.windowing.assigners.EventTimeSessionWindows.mergeWindows方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。