Package io.trino.cost
Class CostCalculatorWithEstimatedExchanges
- java.lang.Object
-
- io.trino.cost.CostCalculatorWithEstimatedExchanges
-
- All Implemented Interfaces:
CostCalculator
@ThreadSafe public class CostCalculatorWithEstimatedExchanges extends Object implements CostCalculator
A wrapper around CostCalculator that estimates ExchangeNodes cost.Certain rules (e.g.
ReorderJoinsandDetermineJoinDistributionType) are run before exchanges are added to a plan. This cost calculator adds the implied costs for the exchanges that will be added later. It is needed to account for the differences in exchange costs for different types of joins.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface io.trino.cost.CostCalculator
CostCalculator.EstimatedExchanges
-
-
Constructor Summary
Constructors Constructor Description CostCalculatorWithEstimatedExchanges(CostCalculator costCalculator, TaskCountEstimator taskCountEstimator)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description PlanCostEstimatecalculateCost(PlanNode node, StatsProvider stats, CostProvider sourcesCosts, Session session, TypeProvider types)Calculates cumulative cost of a node.static LocalCostEstimatecalculateJoinCostWithoutOutput(PlanNode probe, PlanNode build, StatsProvider stats, TypeProvider types, boolean replicated, int estimatedSourceDistributedTaskCount)static LocalCostEstimatecalculateJoinInputCost(PlanNode probe, PlanNode build, StatsProvider stats, TypeProvider types, boolean replicated, int estimatedSourceDistributedTaskCount)static LocalCostEstimatecalculateLocalRepartitionCost(double inputSizeInBytes)static LocalCostEstimatecalculateRemoteGatherCost(double inputSizeInBytes)static LocalCostEstimatecalculateRemoteRepartitionCost(double inputSizeInBytes)static LocalCostEstimatecalculateRemoteReplicateCost(double inputSizeInBytes, int destinationTaskCount)
-
-
-
Constructor Detail
-
CostCalculatorWithEstimatedExchanges
@Inject public CostCalculatorWithEstimatedExchanges(CostCalculator costCalculator, TaskCountEstimator taskCountEstimator)
-
-
Method Detail
-
calculateCost
public PlanCostEstimate calculateCost(PlanNode node, StatsProvider stats, CostProvider sourcesCosts, Session session, TypeProvider types)
Description copied from interface:CostCalculatorCalculates cumulative cost of a node.- Specified by:
calculateCostin interfaceCostCalculator- Parameters:
node- The node to compute cost for.stats- The stats provider for node's stats and child nodes' stats, to be used if stats are needed to compute cost for thenode
-
calculateRemoteGatherCost
public static LocalCostEstimate calculateRemoteGatherCost(double inputSizeInBytes)
-
calculateRemoteRepartitionCost
public static LocalCostEstimate calculateRemoteRepartitionCost(double inputSizeInBytes)
-
calculateLocalRepartitionCost
public static LocalCostEstimate calculateLocalRepartitionCost(double inputSizeInBytes)
-
calculateRemoteReplicateCost
public static LocalCostEstimate calculateRemoteReplicateCost(double inputSizeInBytes, int destinationTaskCount)
-
calculateJoinCostWithoutOutput
public static LocalCostEstimate calculateJoinCostWithoutOutput(PlanNode probe, PlanNode build, StatsProvider stats, TypeProvider types, boolean replicated, int estimatedSourceDistributedTaskCount)
-
calculateJoinInputCost
public static LocalCostEstimate calculateJoinInputCost(PlanNode probe, PlanNode build, StatsProvider stats, TypeProvider types, boolean replicated, int estimatedSourceDistributedTaskCount)
-
-