Class PCollection<T>

java.lang.Object
org.apache.beam.sdk.values.PValueBase
org.apache.beam.sdk.values.PCollection<T>
Type Parameters:
T - the type of the elements of this PCollection
All Implemented Interfaces:
PInput, POutput, PValue

public class PCollection<T> extends PValueBase implements PValue
A PCollection<T> is an immutable collection of values of type T. A PCollection can contain either a bounded or unbounded number of elements. Bounded and unbounded PCollections are produced as the output of PTransforms (including root PTransforms like Read and Create), and can be passed as the inputs of other PTransforms.

Some root transforms produce bounded PCollections and others produce unbounded ones. For example, GenerateSequence.from(long) with GenerateSequence.to(long) produces a fixed set of integers, so it produces a bounded PCollection. GenerateSequence.from(long) without a GenerateSequence.to(long) produces all integers as an infinite stream, so it produces an unbounded PCollection.

Each element in a PCollection has an associated timestamp. Readers assign timestamps to elements when they create PCollections, and other PTransforms propagate these timestamps from their input to their output. See the documentation on BoundedSource.BoundedReader and UnboundedSource.UnboundedReader for more information on how these readers produce timestamps and watermarks.

Additionally, a PCollection has an associated WindowFn and each element is assigned to a set of windows. By default, the windowing function is GlobalWindows and all elements are assigned into a single default window. This default can be overridden with the Window PTransform.

See the individual PTransform subclasses for specific information on how they propagate timestamps and windowing.