com.google.cloud.dataflow.sdk.transforms.join

## Class CoGbkResult

- java.lang.Object
- - com.google.cloud.dataflow.sdk.transforms.join.CoGbkResult

    public class CoGbkResult
    extends Object

A row result of a `CoGroupByKey`. This is a tuple of `Iterable`s produced for a given key, and these can be accessed in different ways.

### Nested Class Summary

Nested Classes
`static class` `CoGbkResult.CoGbkResultCoder` A `Coder` for `CoGbkResult`s.

### Constructor Summary

Constructors
Constructor and Description
`CoGbkResult(CoGbkResultSchema schema, Iterable<RawUnionValue> taggedValues)` A row in the `PCollection` resulting from a `CoGroupByKey` transform.
`CoGbkResult(CoGbkResultSchema schema, Iterable<RawUnionValue> taggedValues, int inMemoryElementCount)`

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods
`<V> CoGbkResult` `and(TupleTag<V> tag, List<V> data)` Returns a new `CoGbkResult` based on this, with the given tag and given data added to it.
`static <V> CoGbkResult` `empty()` Returns an empty `CoGbkResult`.
`<V> Iterable<V>` `getAll(TupleTag<V> tag)` Returns the values from the table represented by the given `TupleTag<V>` as an `Iterable<V>` (which may be empty if there are no results).
`<V> V` `getOnly(TupleTag<V> tag)` If there is a singleton value for the given tag, returns it.
`<V> V` `getOnly(TupleTag<V> tag, V defaultValue)` If there is a singleton value for the given tag, returns it.
`CoGbkResultSchema` `getSchema()` Returns the schema used by this `CoGbkResult`.
`boolean` `isEmpty()`
`static <V> CoGbkResult` `of(TupleTag<V> tag, List<V> data)` Returns a new CoGbkResult that contains just the given tag and given data.
`String` `toString()`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

### Constructor Detail

#### CoGbkResult

    public CoGbkResult(CoGbkResultSchema schema,
                       Iterable<RawUnionValue> taggedValues)

A row in the `PCollection` resulting from a `CoGroupByKey` transform. Currently, this row must fit into memory.

Parameters:
  `schema` - the set of tuple tags used to refer to input tables and result values
  `taggedValues` - the raw results from a group-by-key

#### CoGbkResult

    public CoGbkResult(CoGbkResultSchema schema,
                       Iterable<RawUnionValue> taggedValues,
                       int inMemoryElementCount)

### Method Detail

#### isEmpty

    public boolean isEmpty()

#### getSchema

    public CoGbkResultSchema getSchema()

Returns the schema used by this `CoGbkResult`.

#### toString

    public String toString()

Overrides:
  `toString` in class `Object`

#### getAll

    public <V> Iterable<V> getAll(TupleTag<V> tag)

Returns the values from the table represented by the given `TupleTag<V>` as an `Iterable<V>` (which may be empty if there are no results).

If tag was not part of the original `CoGroupByKey`, throws an IllegalArgumentException.

#### 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(TupleTag<V> tag,
                         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.

#### of

    public static <V> CoGbkResult of(TupleTag<V> tag,
                                     List<V> data)

Returns a new CoGbkResult that contains just the given tag and given data.

#### and

    public <V> CoGbkResult and(TupleTag<V> tag,
                               List<V> data)

Returns a new `CoGbkResult` based on this, with the given tag and given data added to it.

#### empty

    public static <V> CoGbkResult empty()

Returns an empty `CoGbkResult`.