Class PCollectionRowTuple

java.lang.Object
org.apache.beam.sdk.values.PCollectionRowTuple
All Implemented Interfaces:
PInput, POutput

public class PCollectionRowTuple extends Object implements PInput, POutput
A 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();