Class PCollectionList<T>
- Type Parameters:
T
- the type of the elements of all thePCollections
in 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 newPCollectionList
that has all thePCollections
of thisPCollectionList
plus the givenPCollections
appended to the end, in order.and
(PCollection<T> pc) Returns a newPCollectionList
that has all thePCollections
of thisPCollectionList
plus the givenPCollection
appended to the end.<OutputT extends POutput>
OutputTapply
(String name, PTransform<PCollectionList<T>, OutputT> t) Applies the givenPTransform
to this inputPCollectionList
, usingname
to 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 emptyPCollectionList
that is part of the givenPipeline
.boolean
expand()
void
finishSpecifyingOutput
(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 thePCollection
at the given index (origin zero).List
<PCollection<T>> getAll()
Returns an immutable List of all thePCollections
in thisPCollectionList
.int
hashCode()
static <T> PCollectionList
<T> of
(Iterable<PCollection<T>> pcs) Returns aPCollectionList
containing the givenPCollections
, in order.static <T> PCollectionList
<T> of
(PCollection<T> pc) Returns a singletonPCollectionList
containing the givenPCollection
.int
size()
Returns the number ofPCollections
in thisPCollectionList
.
-
Method Details
-
empty
Returns an emptyPCollectionList
that is part of the givenPipeline
.Longer
PCollectionLists
can be created by callingand(org.apache.beam.sdk.values.PCollection<T>)
on the result. -
of
Returns a singletonPCollectionList
containing the givenPCollection
.Longer
PCollectionLists
can be created by callingand(org.apache.beam.sdk.values.PCollection<T>)
on the result. -
of
Returns aPCollectionList
containing the givenPCollections
, in order.The argument list cannot be empty.
All the
PCollections
in the resultingPCollectionList
must 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 newPCollectionList
that has all thePCollections
of thisPCollectionList
plus the givenPCollection
appended to the end.All the
PCollections
in the resultingPCollectionList
must be part of the samePipeline
. -
and
Returns a newPCollectionList
that has all thePCollections
of thisPCollectionList
plus the givenPCollections
appended to the end, in order.All the
PCollections
in the resultingPCollectionList
must be part of the samePipeline
. -
size
public int size()Returns the number ofPCollections
in thisPCollectionList
. -
get
Returns thePCollection
at 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 thePCollections
in 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 givenPTransform
to this inputPCollectionList
, usingname
to 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:
getPipeline
in interfacePInput
- Specified by:
getPipeline
in interfacePOutput
-
expand
Description copied from interface:PInput
Expands thisPInput
into a list of its component outputPValues
.- A
PValue
expands to itself. - A tuple or list of
PValues
(such asPCollectionTuple
orPCollectionList
) expands to its componentPValue PValues
.
Not intended to be invoked directly by user code.
- A
-
finishSpecifyingOutput
Description copied from interface:POutput
As 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
PCollections
haveCoders
specified or defaulted.Automatically invoked whenever this
POutput
is output, afterPOutput.finishSpecifyingOutput(String, PInput, PTransform)
has been called on each componentPValue
returned byPOutput.expand()
.- Specified by:
finishSpecifyingOutput
in interfacePOutput
-
equals
-
hashCode
public int hashCode()
-