public class PCollectionRowTuple extends java.lang.Object implements PInput, POutput
PCollectionRowTuple is an immutable tuple of PCollections
,
"keyed" by a string tag. A PCollectionRowTuple can be used as the input or output of a
PTransform taking or producing multiple PCollection<Row> inputs or outputs.
A PCollectionRowTuple can be created and accessed like follows:
PCollection<Row> pc1 = ...;
PCollection<Row> pc2 = ...;
// Create tags for each of the PCollections to put in the PCollectionRowTuple:
String tag1 = "pc1";
String tag2 = "pc2";
String tag3 = "pc3";
// Create a PCollectionRowTuple with three PCollections:
PCollectionRowTuple pcs = PCollectionRowTuple.of(tag1, pc1).and(tag2, pc2).and(tag3, pc3);
// Create an empty PCollectionRowTuple:
Pipeline p = ...;
PCollectionRowTuple pcs2 = PCollectionRowTuple.empty(p);
// Get PCollections out of a PCollectionRowTuple, using the same tags that were used to put them in:
PCollection<Row> pcX = pcs.get(tag2);
PCollection<Row> pcY = pcs.get(tag1);
// Get a map of all PCollections in a PCollectionRowTuple:
Map<String, PCollection<Row>> allPcs = pcs.getAll();
| Modifier and Type | Method and Description |
|---|---|
PCollectionRowTuple |
and(java.lang.String tag,
PCollection<Row> pc)
Returns a new
PCollectionRowTuple that has each PCollection and tag of this
PCollectionRowTuple plus the given PCollection associated with the given tag. |
<OutputT extends POutput> |
apply(PTransform<? super PCollectionRowTuple,OutputT> t)
Like
apply(String, PTransform) but defaulting to the name of the PTransform. |
<OutputT extends POutput> |
apply(java.lang.String name,
PTransform<? super PCollectionRowTuple,OutputT> t)
Applies the given
PTransform to this input PCollectionRowTuple, using name to identify this specific application of the transform. |
static PCollectionRowTuple |
empty(Pipeline pipeline)
Returns an empty
PCollectionRowTuple that is part of the given Pipeline. |
boolean |
equals(@Nullable java.lang.Object other) |
java.util.Map<TupleTag<?>,PValue> |
expand()
|
void |
finishSpecifyingOutput(java.lang.String transformName,
PInput input,
PTransform<?,?> transform)
As part of applying the producing
PTransform, finalizes this output to make it ready
for being used as an input and for running. |
PCollection<Row> |
get(java.lang.String tag)
|
java.util.Map<java.lang.String,PCollection<Row>> |
getAll()
Returns an immutable Map from tag to corresponding
PCollection, for all the members of
this PCollectionRowTuple. |
Pipeline |
getPipeline()
|
boolean |
has(java.lang.String tag)
Returns whether this
PCollectionRowTuple contains a PCollection with the given
tag. |
int |
hashCode() |
static PCollectionRowTuple |
of(java.lang.String tag,
PCollection<Row> pc)
Returns a singleton
PCollectionRowTuple containing the given PCollection keyed
by the given tag. |
static PCollectionRowTuple |
of(java.lang.String tag1,
PCollection<Row> pc1,
java.lang.String tag2,
PCollection<Row> pc2)
A version of
of(String, PCollection) that takes in two PCollections of the same type. |
static PCollectionRowTuple |
of(java.lang.String tag1,
PCollection<Row> pc1,
java.lang.String tag2,
PCollection<Row> pc2,
java.lang.String tag3,
PCollection<Row> pc3)
A version of
of(String, PCollection) that takes in three PCollections of the same
type. |
static PCollectionRowTuple |
of(java.lang.String tag1,
PCollection<Row> pc1,
java.lang.String tag2,
PCollection<Row> pc2,
java.lang.String tag3,
PCollection<Row> pc3,
java.lang.String tag4,
PCollection<Row> pc4)
A version of
of(String, PCollection) that takes in four PCollections of the same type. |
static PCollectionRowTuple |
of(java.lang.String tag1,
PCollection<Row> pc1,
java.lang.String tag2,
PCollection<Row> pc2,
java.lang.String tag3,
PCollection<Row> pc3,
java.lang.String tag4,
PCollection<Row> pc4,
java.lang.String tag5,
PCollection<Row> pc5)
A version of
of(String, PCollection) that takes in five PCollections of the same type. |
public static PCollectionRowTuple empty(Pipeline pipeline)
PCollectionRowTuple that is part of the given Pipeline.
A PCollectionRowTuple containing additional elements can be created by calling
and(java.lang.String, org.apache.beam.sdk.values.PCollection<org.apache.beam.sdk.values.Row>) on the result.
public static PCollectionRowTuple of(java.lang.String tag, PCollection<Row> pc)
PCollectionRowTuple containing the given PCollection keyed
by the given tag.
A PCollectionRowTuple containing additional elements can be created by calling
and(java.lang.String, org.apache.beam.sdk.values.PCollection<org.apache.beam.sdk.values.Row>) on the result.
public static PCollectionRowTuple of(java.lang.String tag1, PCollection<Row> pc1, java.lang.String tag2, PCollection<Row> pc2)
of(String, PCollection) that takes in two PCollections of the same type.public static PCollectionRowTuple of(java.lang.String tag1, PCollection<Row> pc1, java.lang.String tag2, PCollection<Row> pc2, java.lang.String tag3, PCollection<Row> pc3)
of(String, PCollection) that takes in three PCollections of the same
type.public static PCollectionRowTuple of(java.lang.String tag1, PCollection<Row> pc1, java.lang.String tag2, PCollection<Row> pc2, java.lang.String tag3, PCollection<Row> pc3, java.lang.String tag4, PCollection<Row> pc4)
of(String, PCollection) that takes in four PCollections of the same type.public static PCollectionRowTuple of(java.lang.String tag1, PCollection<Row> pc1, java.lang.String tag2, PCollection<Row> pc2, java.lang.String tag3, PCollection<Row> pc3, java.lang.String tag4, PCollection<Row> pc4, java.lang.String tag5, PCollection<Row> pc5)
of(String, PCollection) that takes in five PCollections of the same type.public PCollectionRowTuple and(java.lang.String tag, PCollection<Row> pc)
PCollectionRowTuple that has each PCollection and tag of this
PCollectionRowTuple plus the given PCollection associated with the given tag.
The given tag should not already be mapped to a PCollection in this PCollectionRowTuple.
Each PCollection in the resulting PCollectionRowTuple must be part of the
same Pipeline.
public boolean has(java.lang.String tag)
PCollectionRowTuple contains a PCollection with the given
tag.public PCollection<Row> get(java.lang.String tag)
PCollection associated with the given String in this PCollectionRowTuple. Throws IllegalArgumentException if there is no such PCollection, i.e., !has(tag).public java.util.Map<java.lang.String,PCollection<Row>> getAll()
PCollection, for all the members of
this PCollectionRowTuple.public <OutputT extends POutput> OutputT apply(PTransform<? super PCollectionRowTuple,OutputT> t)
apply(String, PTransform) but defaulting to the name of the PTransform.PTransformpublic <OutputT extends POutput> OutputT apply(java.lang.String name, PTransform<? super PCollectionRowTuple,OutputT> t)
PTransform to this input PCollectionRowTuple, using name 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.PTransformpublic Pipeline getPipeline()
PInputgetPipeline in interface PInputgetPipeline in interface POutputpublic java.util.Map<TupleTag<?>,PValue> expand()
PInputPInput into a list of its component output PValues.
PValue expands to itself.
PValues (such as PCollectionTuple or PCollectionList) expands to its component PValue PValues.
Not intended to be invoked directly by user code.
public void finishSpecifyingOutput(java.lang.String transformName,
PInput input,
PTransform<?,?> transform)
POutputPTransform, finalizes this output to make it ready
for being used as an input and for running.
This includes ensuring that all PCollections have Coders specified or defaulted.
Automatically invoked whenever this POutput is output, after POutput.finishSpecifyingOutput(String, PInput, PTransform) has been called on each component
PValue returned by POutput.expand().
finishSpecifyingOutput in interface POutputpublic boolean equals(@Nullable java.lang.Object other)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Object