com.google.cloud.dataflow.sdk.transforms

## Class CombineFns.ComposedCombineFn<DataT>

- java.lang.Object
- - com.google.cloud.dataflow.sdk.transforms.Combine.CombineFn<DataT,Object[],CombineFns.CoCombineResult>
  - - com.google.cloud.dataflow.sdk.transforms.CombineFns.ComposedCombineFn<DataT>

All Implemented Interfaces:
  CombineFnBase.GlobalCombineFn<DataT,Object[],CombineFns.CoCombineResult>, HasDisplayData, Serializable

Enclosing class:
  CombineFns

    public static class CombineFns.ComposedCombineFn<DataT>
    extends Combine.CombineFn<DataT,Object[],CombineFns.CoCombineResult>

A composed `Combine.CombineFn` that applies multiple `CombineFns`.

For each `Combine.CombineFn` it extracts inputs from `DataT` with the `extractInputFn` and combines them, and then it outputs each combined value with a `TupleTag` to a `CombineFns.CoCombineResult`.

See Also:
  Serialized Form

### Method Summary

All Methods Instance Methods Concrete Methods
`Object[]` `addInput(Object[] accumulator, DataT value)` Adds the given input value to the given accumulator, returning the new accumulator value.
`Object[]` `compact(Object[] accumulator)` Returns an accumulator that represents the same logical value as the input accumulator, but may have a more compact representation.
`Object[]` `createAccumulator()` Returns a new, mutable accumulator value, representing the accumulation of zero input values.
`CombineFns.CoCombineResult` `extractOutput(Object[] accumulator)` Returns the output value that is the result of combining all the input values represented by the given accumulator.
`TypeVariable<?>` `getAccumTVariable()` Returns the `TypeVariable` of `AccumT`.
`Coder<Object[]>` `getAccumulatorCoder(CoderRegistry registry, Coder<DataT> dataCoder)` Returns the `Coder` to use for accumulator `AccumT` values, or null if it is not able to be inferred.
`Coder<OutputT>` `getDefaultOutputCoder(CoderRegistry registry, Coder<InputT> inputCoder)` Returns the `Coder` to use by default for output `OutputT` values, or null if it is not able to be inferred.
`String` `getIncompatibleGlobalWindowErrorMessage()` Returns the error message for not supported default values in Combine.globally().
`TypeVariable<?>` `getInputTVariable()` Returns the `TypeVariable` of `InputT`.
`TypeVariable<?>` `getOutputTVariable()` Returns the `TypeVariable` of `OutputT`.
`Object[]` `mergeAccumulators(Iterable<Object[]> accumulators)` Returns an accumulator representing the accumulation of all the input values accumulated in the merging accumulators.
`void` `populateDisplayData(DisplayData.Builder builder)` Register display data for the given transform or component.
`<InputT,OutputT> CombineFns.ComposedCombineFn<DataT>` `with(SimpleFunction<DataT,InputT> extractInputFn, Combine.CombineFn<InputT,?,OutputT> combineFn, TupleTag<OutputT> outputTag)` Returns a `CombineFns.ComposedCombineFn` with an additional `Combine.CombineFn`.
`<InputT,OutputT> CombineFns.ComposedCombineFnWithContext<DataT>` `with(SimpleFunction<DataT,InputT> extractInputFn, CombineWithContext.CombineFnWithContext<InputT,?,OutputT> combineFn, TupleTag<OutputT> outputTag)` Returns a `CombineFns.ComposedCombineFnWithContext` with an additional `CombineWithContext.CombineFnWithContext`.

### Methods inherited from class com.google.cloud.dataflow.sdk.transforms.Combine.CombineFn

`apply, asKeyedFn, defaultValue, getOutputType`

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

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

### Method Detail

#### with

    public <InputT,OutputT> CombineFns.ComposedCombineFn<DataT> with(SimpleFunction<DataT,InputT> extractInputFn,
                                                                     Combine.CombineFn<InputT,?,OutputT> combineFn,
                                                                     TupleTag<OutputT> outputTag)

Returns a `CombineFns.ComposedCombineFn` with an additional `Combine.CombineFn`.

#### with

    public <InputT,OutputT> CombineFns.ComposedCombineFnWithContext<DataT> with(SimpleFunction<DataT,InputT> extractInputFn,
                                                                                CombineWithContext.CombineFnWithContext<InputT,?,OutputT> combineFn,
                                                                                TupleTag<OutputT> outputTag)

Returns a `CombineFns.ComposedCombineFnWithContext` with an additional `CombineWithContext.CombineFnWithContext`.

#### createAccumulator

    public Object[] createAccumulator()

Description copied from class: `Combine.CombineFn`
Returns a new, mutable accumulator value, representing the accumulation of zero input values.

Specified by:
  `createAccumulator` in class `Combine.CombineFn<DataT,Object[],CombineFns.CoCombineResult>`

#### addInput

    public Object[] addInput(Object[] accumulator,
                             DataT value)

Description copied from class: `Combine.CombineFn`
Adds the given input value to the given accumulator, returning the new accumulator value.

For efficiency, the input accumulator may be modified and returned.

Specified by:
  `addInput` in class `Combine.CombineFn<DataT,Object[],CombineFns.CoCombineResult>`

#### mergeAccumulators

    public Object[] mergeAccumulators(Iterable<Object[]> accumulators)

Description copied from class: `Combine.CombineFn`
Returns an accumulator representing the accumulation of all the input values accumulated in the merging accumulators.

May modify any of the argument accumulators. May return a fresh accumulator, or may return one of the (modified) argument accumulators.

Specified by:
  `mergeAccumulators` in class `Combine.CombineFn<DataT,Object[],CombineFns.CoCombineResult>`

#### extractOutput

    public CombineFns.CoCombineResult extractOutput(Object[] accumulator)

Description copied from class: `Combine.CombineFn`
Returns the output value that is the result of combining all the input values represented by the given accumulator.

Specified by:
  `extractOutput` in class `Combine.CombineFn<DataT,Object[],CombineFns.CoCombineResult>`

#### compact

    public Object[] compact(Object[] accumulator)

Description copied from class: `Combine.CombineFn`
Returns an accumulator that represents the same logical value as the input accumulator, but may have a more compact representation.

For most CombineFns this would be a no-op, but should be overridden by CombineFns that (for example) buffer up elements and combine them in batches.

For efficiency, the input accumulator may be modified and returned.

By default returns the original accumulator.

Overrides:
  `compact` in class `Combine.CombineFn<DataT,Object[],CombineFns.CoCombineResult>`

#### getAccumulatorCoder

    public Coder<Object[]> getAccumulatorCoder(CoderRegistry registry,
                                               Coder<DataT> dataCoder)
                                        throws CannotProvideCoderException

Description copied from interface: `CombineFnBase.GlobalCombineFn`
Returns the `Coder` to use for accumulator `AccumT` values, or null if it is not able to be inferred.

By default, uses the knowledge of the `Coder` being used for `InputT` values and the enclosing `Pipeline`'s `CoderRegistry` to try to infer the Coder for `AccumT` values.

This is the Coder used to send data through a communication-intensive shuffle step, so a compact and efficient representation may have significant performance benefits.

Specified by:
  `getAccumulatorCoder` in interface `CombineFnBase.GlobalCombineFn<DataT,Object[],CombineFns.CoCombineResult>`
Throws:
  `CannotProvideCoderException`

#### populateDisplayData

    public void populateDisplayData(DisplayData.Builder builder)

Register display data for the given transform or component.

`populateDisplayData(DisplayData.Builder)` is invoked by Pipeline runners to collect display data via `DisplayData.from(HasDisplayData)`. Implementations may call `super.populateDisplayData(builder)` in order to register display data in the current namespace, but should otherwise use `subcomponent.populateDisplayData(builder)` to use the namespace of the subcomponent.

By default, does not register any display data. Implementors may override this method to provide their own display data.

Specified by:
  `populateDisplayData` in interface `HasDisplayData`
Parameters:
  `builder` - The builder to populate with display data.
See Also:
  `HasDisplayData`

#### getDefaultOutputCoder

    public Coder<OutputT> getDefaultOutputCoder(CoderRegistry registry,
                                                Coder<InputT> inputCoder)
                                         throws CannotProvideCoderException

Description copied from interface: `CombineFnBase.GlobalCombineFn`
Returns the `Coder` to use by default for output `OutputT` values, or null if it is not able to be inferred.

By default, uses the knowledge of the `Coder` being used for input `InputT` values and the enclosing `Pipeline`'s `CoderRegistry` to try to infer the Coder for `OutputT` values.

Specified by:
  `getDefaultOutputCoder` in interface `CombineFnBase.GlobalCombineFn<InputT,AccumT,OutputT>`
Throws:
  `CannotProvideCoderException`

#### getIncompatibleGlobalWindowErrorMessage

    public String getIncompatibleGlobalWindowErrorMessage()

Description copied from interface: `CombineFnBase.GlobalCombineFn`
Returns the error message for not supported default values in Combine.globally().

Specified by:
  `getIncompatibleGlobalWindowErrorMessage` in interface `CombineFnBase.GlobalCombineFn<InputT,AccumT,OutputT>`

#### getInputTVariable

    public TypeVariable<?> getInputTVariable()

Returns the `TypeVariable` of `InputT`.

#### getAccumTVariable

    public TypeVariable<?> getAccumTVariable()

Returns the `TypeVariable` of `AccumT`.

#### getOutputTVariable

    public TypeVariable<?> getOutputTVariable()

Returns the `TypeVariable` of `OutputT`.