Class PCollectionList<T>
- Type Parameters:
T- the type of the elements of all thePCollectionsin this list
PCollectionList<T> is an immutable list of homogeneously typed
PCollection<T>s. A PCollectionList is used, for instance, as
the input to Flatten or the output of Partition.
PCollectionLists can be created and accessed like follows:
PCollection<String> pc1 = ...;
PCollection<String> pc2 = ...;
PCollection<String> pc3 = ...;
// Create a PCollectionList with three PCollections:
PCollectionList<String> pcs = PCollectionList.of(pc1).and(pc2).and(pc3);
// Create an empty PCollectionList:
Pipeline p = ...;
PCollectionList<String> pcs2 = PCollectionList.<String>empty(p);
// Get PCollections out of a PCollectionList, by index (origin 0):
PCollection<String> pcX = pcs.get(1);
PCollection<String> pcY = pcs.get(0);
PCollection<String> pcZ = pcs.get(2);
// Get a list of all PCollections in a PCollectionList:
List<PCollection<String>> allPcs = pcs.getAll();
-
Method Summary
Modifier and TypeMethodDescriptionand(Iterable<PCollection<T>> pcs) Returns a newPCollectionListthat has all thePCollectionsof thisPCollectionListplus the givenPCollectionsappended to the end, in order.and(PCollection<T> pc) Returns a newPCollectionListthat has all thePCollectionsof thisPCollectionListplus the givenPCollectionappended to the end.<OutputT extends POutput>
OutputTapply(String name, PTransform<PCollectionList<T>, OutputT> t) Applies the givenPTransformto this inputPCollectionList, usingnameto identify this specific application of the transform.<OutputT extends POutput>
OutputTapply(PTransform<PCollectionList<T>, OutputT> t) Likeapply(String, PTransform)but defaulting to the name of thePTransform.static <T> PCollectionList<T> Returns an emptyPCollectionListthat is part of the givenPipeline.booleanexpand()voidfinishSpecifyingOutput(String transformName, PInput input, PTransform<?, ?> transform) As part of applying the producingPTransform, finalizes this output to make it ready for being used as an input and for running.get(int index) Returns thePCollectionat the given index (origin zero).List<PCollection<T>> getAll()Returns an immutable List of all thePCollectionsin thisPCollectionList.inthashCode()static <T> PCollectionList<T> of(Iterable<PCollection<T>> pcs) Returns aPCollectionListcontaining the givenPCollections, in order.static <T> PCollectionList<T> of(PCollection<T> pc) Returns a singletonPCollectionListcontaining the givenPCollection.intsize()Returns the number ofPCollectionsin thisPCollectionList.
-
Method Details
-
empty
Returns an emptyPCollectionListthat is part of the givenPipeline.Longer
PCollectionListscan be created by callingand(org.apache.beam.sdk.values.PCollection<T>)on the result. -
of
Returns a singletonPCollectionListcontaining the givenPCollection.Longer
PCollectionListscan be created by callingand(org.apache.beam.sdk.values.PCollection<T>)on the result. -
of
Returns aPCollectionListcontaining the givenPCollections, in order.The argument list cannot be empty.
All the
PCollectionsin the resultingPCollectionListmust be part of the samePipeline.Longer PCollectionLists can be created by calling
and(org.apache.beam.sdk.values.PCollection<T>)on the result. -
and
Returns a newPCollectionListthat has all thePCollectionsof thisPCollectionListplus the givenPCollectionappended to the end.All the
PCollectionsin the resultingPCollectionListmust be part of the samePipeline. -
and
Returns a newPCollectionListthat has all thePCollectionsof thisPCollectionListplus the givenPCollectionsappended to the end, in order.All the
PCollectionsin the resultingPCollectionListmust be part of the samePipeline. -
size
public int size()Returns the number ofPCollectionsin thisPCollectionList. -
get
Returns thePCollectionat the given index (origin zero).- Throws:
IndexOutOfBoundsException- if the index is out of the range[0..size()-1].
-
getAll
Returns an immutable List of all thePCollectionsin thisPCollectionList. -
apply
Likeapply(String, PTransform)but defaulting to the name of thePTransform. -
apply
public <OutputT extends POutput> OutputT apply(String name, PTransform<PCollectionList<T>, OutputT> t) Applies the givenPTransformto this inputPCollectionList, usingnameto identify this specific application of the transform. This name is used in various places, including the monitoring UI, logging, and to stably identify this application node in the job graph.- Returns:
- the output of the applied
PTransform
-
getPipeline
Description copied from interface:PInput- Specified by:
getPipelinein interfacePInput- Specified by:
getPipelinein interfacePOutput
-
expand
Description copied from interface:PInputExpands thisPInputinto a list of its component outputPValues.- A
PValueexpands to itself. - A tuple or list of
PValues(such asPCollectionTupleorPCollectionList) expands to its componentPValue PValues.
Not intended to be invoked directly by user code.
- A
-
finishSpecifyingOutput
Description copied from interface:POutputAs part of applying the producingPTransform, finalizes this output to make it ready for being used as an input and for running.This includes ensuring that all
PCollectionshaveCodersspecified or defaulted.Automatically invoked whenever this
POutputis output, afterPOutput.finishSpecifyingOutput(String, PInput, PTransform)has been called on each componentPValuereturned byPOutput.expand().- Specified by:
finishSpecifyingOutputin interfacePOutput
-
equals
-
hashCode
public int hashCode()
-