當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。