Package org.apache.flink.optimizer.plan
Class Channel
- java.lang.Object
-
- org.apache.flink.optimizer.plan.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.
- 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...
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadjustGlobalPropertiesForFullParallelismChange()Channelclone()intgetCostWeight()org.apache.flink.api.common.distributions.DataDistributiongetDataDistribution()org.apache.flink.runtime.io.network.DataExchangeModegetDataExchangeMode()Gets the data exchange mode (batch / pipelined) to use for the data exchange of this channel.floatgetEstimatedAvgWidthPerOutputRecord()Gets the estimated number of bytes per record.longgetEstimatedNumRecords()Gets the estimated number of records in the output of this node.longgetEstimatedOutputSize()Gets the estimated output size from this node.GlobalPropertiesgetGlobalProperties()LocalPropertiesgetLocalProperties()org.apache.flink.runtime.operators.util.LocalStrategygetLocalStrategy()org.apache.flink.api.common.typeutils.TypeComparatorFactory<?>getLocalStrategyComparator()Gets the local strategy comparator from this Channel.org.apache.flink.api.common.operators.util.FieldListgetLocalStrategyKeys()boolean[]getLocalStrategySortOrder()intgetMaxDepth()org.apache.flink.api.common.functions.Partitioner<?>getPartitioner()doublegetRelativeMemoryLocalStrategy()doublegetRelativeTempMemory()Gets the memory for materializing the channel's result from this Channel.intgetReplicationFactor()Returns the replication factor of the connection.RequestedGlobalPropertiesgetRequiredGlobalProps()RequestedLocalPropertiesgetRequiredLocalProps()org.apache.flink.api.common.typeutils.TypeSerializerFactory<?>getSerializer()Gets the serializer from this Channel.org.apache.flink.runtime.operators.shipping.ShipStrategyTypegetShipStrategy()org.apache.flink.api.common.typeutils.TypeComparatorFactory<?>getShipStrategyComparator()Gets the ship strategy comparator from this Channel.org.apache.flink.api.common.operators.util.FieldListgetShipStrategyKeys()boolean[]getShipStrategySortOrder()PlanNodegetSource()Gets the source of this Channel.PlanNodegetTarget()Gets the target of this Channel.TempModegetTempMode()booleanisOnDynamicPath()voidsetDataDistribution(org.apache.flink.api.common.distributions.DataDistribution dataDistribution)voidsetDataExchangeMode(org.apache.flink.runtime.io.network.DataExchangeMode dataExchangeMode)Sets the data exchange mode (batch / pipelined) to use for the data exchange of this channel.voidsetLocalStrategy(org.apache.flink.runtime.operators.util.LocalStrategy strategy)voidsetLocalStrategy(org.apache.flink.runtime.operators.util.LocalStrategy strategy, org.apache.flink.api.common.operators.util.FieldList keys, boolean[] sortDirection)voidsetLocalStrategyComparator(org.apache.flink.api.common.typeutils.TypeComparatorFactory<?> localStrategyComparator)Sets the local strategy comparator for this Channel.voidsetRelativeMemoryLocalStrategy(double relativeMemoryLocalStrategy)voidsetRelativeTempMemory(double relativeTempMemory)Sets the memory for materializing the channel's result from this Channel.voidsetReplicationFactor(int factor)Sets the replication factor of the connection.voidsetRequiredGlobalProps(RequestedGlobalProperties requiredGlobalProps)voidsetRequiredLocalProps(RequestedLocalProperties requiredLocalProps)voidsetSerializer(org.apache.flink.api.common.typeutils.TypeSerializerFactory<?> serializer)Sets the serializer for this Channel.voidsetShipStrategy(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)voidsetShipStrategy(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)voidsetShipStrategy(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)voidsetShipStrategy(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)voidsetShipStrategy(org.apache.flink.runtime.operators.shipping.ShipStrategyType strategy, org.apache.flink.runtime.io.network.DataExchangeMode dataExchangeMode)voidsetShipStrategyComparator(org.apache.flink.api.common.typeutils.TypeComparatorFactory<?> shipStrategyComparator)Sets the ship strategy comparator for this Channel.voidsetSource(PlanNode source)voidsetTarget(PlanNode target)Sets the target of this Channel.voidsetTempMode(TempMode tempMode)Sets the temp mode of the connection.voidswapUnionNodes(PlanNode newUnionNode)Utility method used while swapping binary union nodes for n-ary union nodes.StringtoString()
-
-
-
Method Detail
-
getSource
public PlanNode getSource()
Gets the source of this Channel.- Specified by:
getSourcein interfaceDumpableConnection<PlanNode>- Returns:
- The source.
-
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.
-
getShipStrategy
public org.apache.flink.runtime.operators.shipping.ShipStrategyType getShipStrategy()
- Specified by:
getShipStrategyin interfaceDumpableConnection<PlanNode>
-
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()
-
getEstimatedOutputSize
public long getEstimatedOutputSize()
Description copied from interface:EstimateProviderGets the estimated output size from this node.- Specified by:
getEstimatedOutputSizein interfaceEstimateProvider- Returns:
- The estimated output size.
-
getEstimatedNumRecords
public long getEstimatedNumRecords()
Description copied from interface:EstimateProviderGets the estimated number of records in the output of this node.- Specified by:
getEstimatedNumRecordsin interfaceEstimateProvider- Returns:
- The estimated number of records.
-
getEstimatedAvgWidthPerOutputRecord
public float getEstimatedAvgWidthPerOutputRecord()
Description copied from interface:EstimateProviderGets the estimated number of bytes per record.- Specified by:
getEstimatedAvgWidthPerOutputRecordin interfaceEstimateProvider- Returns:
- The estimated number of bytes per record.
-
getRequiredGlobalProps
public RequestedGlobalProperties getRequiredGlobalProps()
-
setRequiredGlobalProps
public void setRequiredGlobalProps(RequestedGlobalProperties requiredGlobalProps)
-
getRequiredLocalProps
public RequestedLocalProperties getRequiredLocalProps()
-
setRequiredLocalProps
public void setRequiredLocalProps(RequestedLocalProperties requiredLocalProps)
-
getGlobalProperties
public GlobalProperties getGlobalProperties()
-
getLocalProperties
public LocalProperties getLocalProperties()
-
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()
-
-