Class CoGbkResult
- java.lang.Object
-
- org.apache.beam.sdk.transforms.join.CoGbkResult
-
public class CoGbkResult extends java.lang.Object
A row result of aCoGroupByKey
. This is a tuple ofIterable
s produced for a given key, and these can be accessed in different ways.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
CoGbkResult.CoGbkResultCoder
ACoder
forCoGbkResult
s.
-
Constructor Summary
Constructors Constructor Description CoGbkResult(CoGbkResultSchema schema, java.lang.Iterable<RawUnionValue> taggedValues)
A row in thePCollection
resulting from aCoGroupByKey
transform.CoGbkResult(CoGbkResultSchema schema, java.lang.Iterable<RawUnionValue> taggedValues, int inMemoryElementCount, int minElementsPerTag)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description <V> CoGbkResult
and(TupleTag<V> tag, java.util.List<V> data)
Returns a newCoGbkResult
based on this, with the given tag and given data added to it.static <V> CoGbkResult
empty()
Returns an emptyCoGbkResult
.<V> java.lang.Iterable<V>
getAll(java.lang.String tag)
LikegetAll(TupleTag)
but using a String instead of aTupleTag
.<V> java.lang.Iterable<V>
getAll(TupleTag<V> tag)
Returns the values from the table represented by the givenTupleTag<V>
as anIterable<V>
(which may be empty if there are no results).<V> V
getOnly(java.lang.String tag)
LikegetOnly(TupleTag)
but using a String instead of a TupleTag.<V> @Nullable V
getOnly(java.lang.String tag, @Nullable V defaultValue)
LikegetOnly(TupleTag, Object)
but using a String instead of a TupleTag.<V> V
getOnly(TupleTag<V> tag)
If there is a singleton value for the given tag, returns it.<V> @Nullable V
getOnly(TupleTag<V> tag, @Nullable V defaultValue)
If there is a singleton value for the given tag, returns it.CoGbkResultSchema
getSchema()
Returns the schema used by thisCoGbkResult
.boolean
isEmpty()
static <V> CoGbkResult
of(TupleTag<V> tag, java.util.List<V> data)
Returns a new CoGbkResult that contains just the given tag and given data.java.lang.String
toString()
-
-
-
Constructor Detail
-
CoGbkResult
public CoGbkResult(CoGbkResultSchema schema, java.lang.Iterable<RawUnionValue> taggedValues)
A row in thePCollection
resulting from aCoGroupByKey
transform. Currently, this row must fit into memory.- Parameters:
schema
- the set of tuple tags used to refer to input tables and result valuestaggedValues
- the raw results from a group-by-key
-
CoGbkResult
public CoGbkResult(CoGbkResultSchema schema, java.lang.Iterable<RawUnionValue> taggedValues, int inMemoryElementCount, int minElementsPerTag)
-
-
Method Detail
-
isEmpty
public boolean isEmpty()
-
getSchema
public CoGbkResultSchema getSchema()
Returns the schema used by thisCoGbkResult
.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
getAll
public <V> java.lang.Iterable<V> getAll(TupleTag<V> tag)
Returns the values from the table represented by the givenTupleTag<V>
as anIterable<V>
(which may be empty if there are no results).If tag was not part of the original
CoGroupByKey
, throws an IllegalArgumentException.
-
getAll
public <V> java.lang.Iterable<V> getAll(java.lang.String tag)
LikegetAll(TupleTag)
but using a String instead of aTupleTag
.
-
getOnly
public <V> V getOnly(TupleTag<V> tag)
If there is a singleton value for the given tag, returns it. Otherwise, throws an IllegalArgumentException.If tag was not part of the original
CoGroupByKey
, throws an IllegalArgumentException.
-
getOnly
public <V> V getOnly(java.lang.String tag)
LikegetOnly(TupleTag)
but using a String instead of a TupleTag.
-
getOnly
public <V> @Nullable V getOnly(TupleTag<V> tag, @Nullable V defaultValue)
If there is a singleton value for the given tag, returns it. If there is no value for the given tag, returns the defaultValue.If tag was not part of the original
CoGroupByKey
, throws an IllegalArgumentException.
-
getOnly
public <V> @Nullable V getOnly(java.lang.String tag, @Nullable V defaultValue)
LikegetOnly(TupleTag, Object)
but using a String instead of a TupleTag.
-
of
public static <V> CoGbkResult of(TupleTag<V> tag, java.util.List<V> data)
Returns a new CoGbkResult that contains just the given tag and given data.
-
and
public <V> CoGbkResult and(TupleTag<V> tag, java.util.List<V> data)
Returns a newCoGbkResult
based on this, with the given tag and given data added to it.
-
empty
public static <V> CoGbkResult empty()
Returns an emptyCoGbkResult
.
-
-