public static boolean isSupported(WindowingStrategy<?, ?> strategy) {
    // TODO: Add support for other triggers.
    if (!(strategy.getTrigger().getSpec() instanceof DefaultTrigger)) {
      return false;
    }

    // Right now, we support ACCUMULATING_FIRED_PANES because it is the same as
    // DISCARDING_FIRED_PANES. In Batch mode there is no late data so the default
    // trigger (after watermark) will only fire once.
    if (!strategy.getMode().equals(AccumulationMode.DISCARDING_FIRED_PANES)
        && !strategy.getMode().equals(AccumulationMode.ACCUMULATING_FIRED_PANES)) {
      return false;
    }

    return true;
  }
Пример #2
0
  private TriggerTester(
      WindowingStrategy<?, W> wildcardStrategy,
      ReduceFn<String, InputT, OutputT, W> reduceFn,
      Coder<OutputT> outputCoder)
      throws Exception {
    @SuppressWarnings("unchecked")
    WindowingStrategy<Object, W> objectStrategy = (WindowingStrategy<Object, W>) wildcardStrategy;

    this.windowFn = objectStrategy.getWindowFn();
    this.stubContexts = new StubContexts();
    this.outputCoder = outputCoder;
    executableTrigger = wildcardStrategy.getTrigger();

    this.runner =
        new ReduceFnRunner<>(
            KEY,
            objectStrategy,
            timerInternals,
            stubContexts,
            droppedDueToClosedWindow,
            droppedDueToLateness,
            reduceFn);
  }