Class Channel

  • All Implemented Interfaces:
    Cloneable, EstimateProvider, DumpableConnection<PlanNode>
    Direct Known Subclasses:
    NamedChannel

    public class Channel
    extends Object
    implements EstimateProvider, Cloneable, DumpableConnection<PlanNode>
    A Channel represents the result produced by an operator and the data exchange before the consumption by the target operator.

    The channel defines and tracks various properties and characteristics of the data set and data exchange.

    Data set characteristics:

    • The "global properties" of the data, i.e., how the data is distributed across partitions
    • The "required global properties" of the data, i.e., the global properties that, if absent, would cause the program to return a wrong result.
    • The "local properties" of the data, i.e., how the data is organized within a partition
    • The "required local properties" of the data, i.e., the local properties that, if absent, would cause the program to return a wrong result.
    Data exchange parameters:
    • The "ship strategy", i.e., whether to forward the data, shuffle it, broadcast it, ...
    • The "ship keys", which are the positions of the key fields in the exchanged records.
    • The "data exchange mode", which defines whether to pipeline or batch the exchange
    • Several more...
    • Constructor Detail

      • Channel

        public Channel​(PlanNode sourceNode)
    • Method Detail

      • setSource

        public void setSource​(PlanNode source)
      • setTarget

        public void setTarget​(PlanNode target)
        Sets the target of this Channel.
        Parameters:
        target - The target.
      • getTarget

        public PlanNode getTarget()
        Gets the target of this Channel.
        Returns:
        The target.
      • setShipStrategy

        public void setShipStrategy​(org.apache.flink.runtime.operators.shipping.ShipStrategyType strategy,
                                    org.apache.flink.runtime.io.network.DataExchangeMode dataExchangeMode)
      • setShipStrategy

        public void setShipStrategy​(org.apache.flink.runtime.operators.shipping.ShipStrategyType strategy,
                                    org.apache.flink.api.common.operators.util.FieldList keys,
                                    org.apache.flink.runtime.io.network.DataExchangeMode dataExchangeMode)
      • setShipStrategy

        public void setShipStrategy​(org.apache.flink.runtime.operators.shipping.ShipStrategyType strategy,
                                    org.apache.flink.api.common.operators.util.FieldList keys,
                                    boolean[] sortDirection,
                                    org.apache.flink.runtime.io.network.DataExchangeMode dataExchangeMode)
      • setShipStrategy

        public void setShipStrategy​(org.apache.flink.runtime.operators.shipping.ShipStrategyType strategy,
                                    org.apache.flink.api.common.operators.util.FieldList keys,
                                    org.apache.flink.api.common.functions.Partitioner<?> partitioner,
                                    org.apache.flink.runtime.io.network.DataExchangeMode dataExchangeMode)
      • setShipStrategy

        public void setShipStrategy​(org.apache.flink.runtime.operators.shipping.ShipStrategyType strategy,
                                    org.apache.flink.api.common.operators.util.FieldList keys,
                                    boolean[] sortDirection,
                                    org.apache.flink.api.common.functions.Partitioner<?> partitioner,
                                    org.apache.flink.runtime.io.network.DataExchangeMode dataExchangeMode)
      • setDataExchangeMode

        public void setDataExchangeMode​(org.apache.flink.runtime.io.network.DataExchangeMode dataExchangeMode)
        Sets the data exchange mode (batch / pipelined) to use for the data exchange of this channel.
      • getDataExchangeMode

        public org.apache.flink.runtime.io.network.DataExchangeMode getDataExchangeMode()
        Gets the data exchange mode (batch / pipelined) to use for the data exchange of this channel.
        Returns:
        The data exchange mode of this channel.
      • getShipStrategyKeys

        public org.apache.flink.api.common.operators.util.FieldList getShipStrategyKeys()
      • getShipStrategySortOrder

        public boolean[] getShipStrategySortOrder()
      • setLocalStrategy

        public void setLocalStrategy​(org.apache.flink.runtime.operators.util.LocalStrategy strategy)
      • setLocalStrategy

        public void setLocalStrategy​(org.apache.flink.runtime.operators.util.LocalStrategy strategy,
                                     org.apache.flink.api.common.operators.util.FieldList keys,
                                     boolean[] sortDirection)
      • getLocalStrategy

        public org.apache.flink.runtime.operators.util.LocalStrategy getLocalStrategy()
      • getLocalStrategyKeys

        public org.apache.flink.api.common.operators.util.FieldList getLocalStrategyKeys()
      • getLocalStrategySortOrder

        public boolean[] getLocalStrategySortOrder()
      • setDataDistribution

        public void setDataDistribution​(org.apache.flink.api.common.distributions.DataDistribution dataDistribution)
      • getDataDistribution

        public org.apache.flink.api.common.distributions.DataDistribution getDataDistribution()
      • getPartitioner

        public org.apache.flink.api.common.functions.Partitioner<?> getPartitioner()
      • getTempMode

        public TempMode getTempMode()
      • setTempMode

        public void setTempMode​(TempMode tempMode)
        Sets the temp mode of the connection.
        Parameters:
        tempMode - The temp mode of the connection.
      • getRelativeTempMemory

        public double getRelativeTempMemory()
        Gets the memory for materializing the channel's result from this Channel.
        Returns:
        The temp memory.
      • setRelativeTempMemory

        public void setRelativeTempMemory​(double relativeTempMemory)
        Sets the memory for materializing the channel's result from this Channel.
        Parameters:
        relativeTempMemory - The memory for materialization.
      • setReplicationFactor

        public void setReplicationFactor​(int factor)
        Sets the replication factor of the connection.
        Parameters:
        factor - The replication factor of the connection.
      • getReplicationFactor

        public int getReplicationFactor()
        Returns the replication factor of the connection.
        Returns:
        The replication factor of the connection.
      • getSerializer

        public org.apache.flink.api.common.typeutils.TypeSerializerFactory<?> getSerializer()
        Gets the serializer from this Channel.
        Returns:
        The serializer.
      • setSerializer

        public void setSerializer​(org.apache.flink.api.common.typeutils.TypeSerializerFactory<?> serializer)
        Sets the serializer for this Channel.
        Parameters:
        serializer - The serializer to set.
      • getShipStrategyComparator

        public org.apache.flink.api.common.typeutils.TypeComparatorFactory<?> getShipStrategyComparator()
        Gets the ship strategy comparator from this Channel.
        Returns:
        The ship strategy comparator.
      • setShipStrategyComparator

        public void setShipStrategyComparator​(org.apache.flink.api.common.typeutils.TypeComparatorFactory<?> shipStrategyComparator)
        Sets the ship strategy comparator for this Channel.
        Parameters:
        shipStrategyComparator - The ship strategy comparator to set.
      • getLocalStrategyComparator

        public org.apache.flink.api.common.typeutils.TypeComparatorFactory<?> getLocalStrategyComparator()
        Gets the local strategy comparator from this Channel.
        Returns:
        The local strategy comparator.
      • setLocalStrategyComparator

        public void setLocalStrategyComparator​(org.apache.flink.api.common.typeutils.TypeComparatorFactory<?> localStrategyComparator)
        Sets the local strategy comparator for this Channel.
        Parameters:
        localStrategyComparator - The local strategy comparator to set.
      • getRelativeMemoryLocalStrategy

        public double getRelativeMemoryLocalStrategy()
      • setRelativeMemoryLocalStrategy

        public void setRelativeMemoryLocalStrategy​(double relativeMemoryLocalStrategy)
      • isOnDynamicPath

        public boolean isOnDynamicPath()
      • getCostWeight

        public int getCostWeight()
      • getEstimatedNumRecords

        public long getEstimatedNumRecords()
        Description copied from interface: EstimateProvider
        Gets the estimated number of records in the output of this node.
        Specified by:
        getEstimatedNumRecords in interface EstimateProvider
        Returns:
        The estimated number of records.
      • adjustGlobalPropertiesForFullParallelismChange

        public void adjustGlobalPropertiesForFullParallelismChange()
      • swapUnionNodes

        public void swapUnionNodes​(PlanNode newUnionNode)
        Utility method used while swapping binary union nodes for n-ary union nodes.
      • getMaxDepth

        public int getMaxDepth()