Class OutputEmitter<T>

java.lang.Object
org.apache.flink.runtime.operators.shipping.OutputEmitter<T>
Type Parameters:
T - The type of the element handled by the emitter.
All Implemented Interfaces:
ChannelSelector<SerializationDelegate<T>>

public class OutputEmitter<T> extends Object implements ChannelSelector<SerializationDelegate<T>>
The output emitter decides to which of the possibly multiple output channels a record is sent. It implement routing based on hash-partitioning, broadcasting, round-robin, custom partition functions, etc.
  • Constructor Summary

    Constructors
    Constructor
    Description
    OutputEmitter(ShipStrategyType strategy, int indexInSubtaskGroup)
    Creates a new channel selector that uses the given strategy (broadcasting, partitioning, ...)
    OutputEmitter(ShipStrategyType strategy, int indexInSubtaskGroup, org.apache.flink.api.common.typeutils.TypeComparator<T> comparator, org.apache.flink.api.common.functions.Partitioner<?> partitioner, org.apache.flink.api.common.distributions.DataDistribution distribution)
     
    OutputEmitter(ShipStrategyType strategy, org.apache.flink.api.common.typeutils.TypeComparator<T> comparator)
    Creates a new channel selector that uses the given strategy (broadcasting, partitioning, ...)
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Returns whether the channel selector always selects all the output channels.
    final int
    Returns the logical channel index, to which the given record should be written.
    void
    setup(int numberOfChannels)
    Initializes the channel selector with the number of output channels.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • OutputEmitter

      public OutputEmitter(ShipStrategyType strategy, int indexInSubtaskGroup)
      Creates a new channel selector that uses the given strategy (broadcasting, partitioning, ...) and uses the supplied task index perform a round robin distribution.
      Parameters:
      strategy - The distribution strategy to be used.
    • OutputEmitter

      public OutputEmitter(ShipStrategyType strategy, org.apache.flink.api.common.typeutils.TypeComparator<T> comparator)
      Creates a new channel selector that uses the given strategy (broadcasting, partitioning, ...) and uses the supplied comparator to hash / compare records for partitioning them deterministically.
      Parameters:
      strategy - The distribution strategy to be used.
      comparator - The comparator used to hash / compare the records.
    • OutputEmitter

      public OutputEmitter(ShipStrategyType strategy, int indexInSubtaskGroup, org.apache.flink.api.common.typeutils.TypeComparator<T> comparator, org.apache.flink.api.common.functions.Partitioner<?> partitioner, org.apache.flink.api.common.distributions.DataDistribution distribution)
  • Method Details

    • setup

      public void setup(int numberOfChannels)
      Description copied from interface: ChannelSelector
      Initializes the channel selector with the number of output channels.
      Specified by:
      setup in interface ChannelSelector<T>
      Parameters:
      numberOfChannels - the total number of output channels which are attached to respective output gate.
    • selectChannel

      public final int selectChannel(SerializationDelegate<T> record)
      Description copied from interface: ChannelSelector
      Returns the logical channel index, to which the given record should be written. It is illegal to call this method for broadcast channel selectors and this method can remain not implemented in that case (for example by throwing UnsupportedOperationException).
      Specified by:
      selectChannel in interface ChannelSelector<T>
      Parameters:
      record - the record to determine the output channels for.
      Returns:
      an integer number which indicates the index of the output channel through which the record shall be forwarded.
    • isBroadcast

      public boolean isBroadcast()
      Description copied from interface: ChannelSelector
      Returns whether the channel selector always selects all the output channels.
      Specified by:
      isBroadcast in interface ChannelSelector<T>
      Returns:
      true if the selector is for broadcast mode.