public static <T, W extends BoundedWindow> WindowingStrategy<T, W> of(WindowFn<T, W> windowFn) { return new WindowingStrategy<>( windowFn, DefaultTrigger.of(), false, AccumulationMode.DISCARDING_FIRED_PANES, false, DEFAULT_ALLOWED_LATENESS, false, TimestampCombiner.END_OF_WINDOW, false, ClosingBehavior.FIRE_IF_NON_EMPTY, OnTimeBehavior.FIRE_ALWAYS); }
/** Returns the default trigger. */ public static DefaultTrigger of() { return new DefaultTrigger(); }
@Test public void testContinuation() throws Exception { assertEquals(DefaultTrigger.of(), DefaultTrigger.of().getContinuationTrigger()); } }
@Test public void testFireDeadline() throws Exception { assertEquals( new Instant(9), DefaultTrigger.of() .getWatermarkThatGuaranteesFiring(new IntervalWindow(new Instant(0), new Instant(10)))); assertEquals( GlobalWindow.INSTANCE.maxTimestamp(), DefaultTrigger.of().getWatermarkThatGuaranteesFiring(GlobalWindow.INSTANCE)); }
@Test public void testDisplayDataExcludesDefaults() { Window<?> window = Window.into(new GlobalWindows()) .triggering(DefaultTrigger.of()) .withAllowedLateness(Duration.millis(BoundedWindow.TIMESTAMP_MAX_VALUE.getMillis())); DisplayData data = DisplayData.from(window); assertThat(data, not(hasDisplayItem("trigger"))); assertThat(data, not(hasDisplayItem("allowedLateness"))); }
@Test public void testUnsupportedGlobalWindowWithDefaultTrigger() { exceptions.expect(UnsupportedOperationException.class); pipeline.enableAbandonedNodeEnforcement(false); PCollection<Row> input = unboundedInput1.apply( "unboundedInput1.globalWindow", Window.<Row>into(new GlobalWindows()).triggering(DefaultTrigger.of())); String sql = "SELECT f_int2, COUNT(*) AS `size` FROM PCOLLECTION GROUP BY f_int2"; input.apply("testUnsupportedGlobalWindows", SqlTransform.query(sql)); }
WindowingStrategy<?, IntervalWindow> strategy = WindowingStrategy.of((WindowFn<?, IntervalWindow>) FixedWindows.of(Duration.millis(10))) .withTrigger(DefaultTrigger.of()) .withMode(AccumulationMode.ACCUMULATING_FIRED_PANES) .withAllowedLateness(Duration.millis(100));
input.apply( Window.<T>into(new GlobalWindows()) .triggering(DefaultTrigger.of()) .discardingFiredPanes());
input.apply( Window.<T>into(new GlobalWindows()) .triggering(DefaultTrigger.of()) .discardingFiredPanes());
return Repeatedly.forever(fromProto(triggerProto.getRepeat().getSubtrigger())); case DEFAULT: return DefaultTrigger.of(); case TRIGGER_NOT_SET: throw new IllegalArgumentException(
"RewindowIntoGlobal", Window.<UserT>into(new GlobalWindows()) .triggering(DefaultTrigger.of()) .discardingFiredPanes());
"GlobalWindow", Window.<KV<ShardedKey<String>, TableRowInfo>>into(new GlobalWindows()) .triggering(DefaultTrigger.of()) .discardingFiredPanes()) .apply(
"rewindowIntoGlobal", Window.<KV<DestinationT, TableRow>>into(new GlobalWindows()) .triggering(DefaultTrigger.of()) .discardingFiredPanes()); PCollection<WriteBundlesToFiles.Result<DestinationT>> results =
toProtoAndBackSpec(AfterSynchronizedProcessingTime.ofFirstElement()), toProtoAndBackSpec(Never.ever()), toProtoAndBackSpec(DefaultTrigger.of()), toProtoAndBackSpec(AfterProcessingTime.pastFirstElementInPane()), toProtoAndBackSpec(