@SuppressWarnings({"rawtypes", "unchecked"}) @Override public PCollection<KV<K, Iterable<WindowedValue<V>>>> expand(PCollection<KV<K, V>> input) { return PCollection.createPrimitiveOutputInternal( input.getPipeline(), input.getWindowingStrategy(), input.isBounded(), (Coder) GroupByKey.getOutputKvCoder(input.getCoder())); } }
@Override public PCollection<KV<K, Iterable<V>>> expand(PCollection<KV<K, V>> input) { applicableTo(input); // Verify that the input Coder<KV<K, V>> is a KvCoder<K, V>, and that // the key coder is deterministic. Coder<K> keyCoder = getKeyCoder(input.getCoder()); try { keyCoder.verifyDeterministic(); } catch (NonDeterministicException e) { throw new IllegalStateException("the keyCoder of a GroupByKey must be deterministic", e); } // This primitive operation groups by the combination of key and window, // merging windows as needed, using the windows assigned to the // key/value input elements and the window merge operation of the // window function associated with the input PCollection. return PCollection.createPrimitiveOutputInternal( input.getPipeline(), updateWindowingStrategy(input.getWindowingStrategy()), input.isBounded(), getOutputKvCoder(input.getCoder())); }