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. ReorderJoins and DetermineJoinDistributionType) 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
ConstructorsConstructorDescriptionCostCalculatorWithEstimatedExchanges(CostCalculator costCalculator, TaskCountEstimator taskCountEstimator) -
Method Summary
Modifier and TypeMethodDescriptionstatic LocalCostEstimateadjustReplicatedJoinLocalExchangeCost(PlanNode build, StatsProvider stats, boolean replicated, int estimatedSourceDistributedTaskCount) calculateCost(PlanNode node, StatsProvider stats, CostProvider sourcesCosts, Session session) Calculates cumulative cost of a node.static LocalCostEstimatecalculateJoinCostWithoutOutput(PlanNode probe, PlanNode build, StatsProvider stats, boolean replicated, int estimatedSourceDistributedTaskCount) static LocalCostEstimatecalculateJoinInputCost(PlanNode probe, PlanNode build, StatsProvider stats, boolean replicated, int estimatedSourceDistributedTaskCount) static LocalCostEstimatecalculateLocalRepartitionCost(double inputSizeInBytes) static LocalCostEstimatecalculateRemoteGatherCost(double inputSizeInBytes) static LocalCostEstimatecalculateRemoteRepartitionCost(double inputSizeInBytes) static LocalCostEstimatecalculateRemoteReplicateCost(double inputSizeInBytes, int destinationTaskCount)
-
Constructor Details
-
CostCalculatorWithEstimatedExchanges
@Inject public CostCalculatorWithEstimatedExchanges(CostCalculator costCalculator, TaskCountEstimator taskCountEstimator)
-
-
Method Details
-
calculateCost
public PlanCostEstimate calculateCost(PlanNode node, StatsProvider stats, CostProvider sourcesCosts, Session session) 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
-
calculateRemoteRepartitionCost
-
calculateLocalRepartitionCost
-
calculateRemoteReplicateCost
public static LocalCostEstimate calculateRemoteReplicateCost(double inputSizeInBytes, int destinationTaskCount) -
calculateJoinCostWithoutOutput
public static LocalCostEstimate calculateJoinCostWithoutOutput(PlanNode probe, PlanNode build, StatsProvider stats, boolean replicated, int estimatedSourceDistributedTaskCount) -
adjustReplicatedJoinLocalExchangeCost
public static LocalCostEstimate adjustReplicatedJoinLocalExchangeCost(PlanNode build, StatsProvider stats, boolean replicated, int estimatedSourceDistributedTaskCount) -
calculateJoinInputCost
public static LocalCostEstimate calculateJoinInputCost(PlanNode probe, PlanNode build, StatsProvider stats, boolean replicated, int estimatedSourceDistributedTaskCount)
-