
com.google.cloud.dataflow.sdk.util.GroupAlsoByWindowsDoFn Maven / Gradle / Ivy
/*
* Copyright (C) 2015 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package com.google.cloud.dataflow.sdk.util;
import com.google.cloud.dataflow.sdk.coders.Coder;
import com.google.cloud.dataflow.sdk.transforms.Aggregator;
import com.google.cloud.dataflow.sdk.transforms.DoFn;
import com.google.cloud.dataflow.sdk.transforms.Sum;
import com.google.cloud.dataflow.sdk.transforms.windowing.BoundedWindow;
import com.google.cloud.dataflow.sdk.values.KV;
import com.google.common.base.Preconditions;
import org.joda.time.Instant;
/**
* DoFn that merges windows and groups elements in those windows, optionally
* combining values.
*
* @param key type
* @param input value element type
* @param output value element type
* @param window type
*/
@SystemDoFnInternal
@SuppressWarnings("serial")
public abstract class GroupAlsoByWindowsDoFn
extends DoFn>>, KV> {
/**
* Create a {@link GroupAlsoByWindowsDoFn} without a combine function. Depending on the
* {@code windowFn} this will either use iterators or window sets to implement the grouping.
*
* @param windowingStrategy The window function and trigger to use for grouping
* @param inputCoder the input coder to use
*/
public static GroupAlsoByWindowsDoFn, W>
createForIterable(WindowingStrategy, W> windowingStrategy, Coder inputCoder) {
@SuppressWarnings("unchecked")
WindowingStrategy
© 2015 - 2025 Weber Informatics LLC | Privacy Policy