use of com.facebook.presto.cost.CachingCostProvider in project presto by prestodb.
the class RuleAssert method ruleContext.
private Rule.Context ruleContext(StatsCalculator statsCalculator, CostCalculator costCalculator, PlanVariableAllocator variableAllocator, Memo memo, Lookup lookup, Session session) {
StatsProvider statsProvider = new CachingStatsProvider(statsCalculator, Optional.of(memo), lookup, session, variableAllocator.getTypes());
CostProvider costProvider = new CachingCostProvider(costCalculator, statsProvider, Optional.of(memo), session);
return new Rule.Context() {
@Override
public Lookup getLookup() {
return lookup;
}
@Override
public PlanNodeIdAllocator getIdAllocator() {
return idAllocator;
}
@Override
public PlanVariableAllocator getVariableAllocator() {
return variableAllocator;
}
@Override
public Session getSession() {
return session;
}
@Override
public StatsProvider getStatsProvider() {
return statsProvider;
}
@Override
public CostProvider getCostProvider() {
return costProvider;
}
@Override
public void checkTimeoutNotExhausted() {
}
@Override
public WarningCollector getWarningCollector() {
return WarningCollector.NOOP;
}
};
}
use of com.facebook.presto.cost.CachingCostProvider in project presto by prestodb.
the class IterativeOptimizer method ruleContext.
private Rule.Context ruleContext(Context context) {
StatsProvider statsProvider = new CachingStatsProvider(statsCalculator, Optional.of(context.memo), context.lookup, context.session, context.variableAllocator.getTypes());
CostProvider costProvider = new CachingCostProvider(costCalculator, statsProvider, Optional.of(context.memo), context.session);
return new Rule.Context() {
@Override
public Lookup getLookup() {
return context.lookup;
}
@Override
public PlanNodeIdAllocator getIdAllocator() {
return context.idAllocator;
}
@Override
public PlanVariableAllocator getVariableAllocator() {
return context.variableAllocator;
}
@Override
public Session getSession() {
return context.session;
}
@Override
public StatsProvider getStatsProvider() {
return statsProvider;
}
@Override
public CostProvider getCostProvider() {
return costProvider;
}
@Override
public void checkTimeoutNotExhausted() {
context.checkTimeoutNotExhausted();
}
@Override
public WarningCollector getWarningCollector() {
return context.warningCollector;
}
};
}
use of com.facebook.presto.cost.CachingCostProvider in project presto by prestodb.
the class LogicalPlanner method computeStats.
private StatsAndCosts computeStats(PlanNode root, TypeProvider types) {
if (explain || isPrintStatsForNonJoinQuery(session) || PlanNodeSearcher.searchFrom(root).where(node -> (node instanceof JoinNode) || (node instanceof SemiJoinNode)).matches()) {
StatsProvider statsProvider = new CachingStatsProvider(statsCalculator, session, types);
CostProvider costProvider = new CachingCostProvider(costCalculator, statsProvider, Optional.empty(), session);
return StatsAndCosts.create(root, statsProvider, costProvider);
}
return StatsAndCosts.empty();
}
use of com.facebook.presto.cost.CachingCostProvider in project presto by prestodb.
the class TestJoinEnumerator method createContext.
private Rule.Context createContext() {
PlanNodeIdAllocator planNodeIdAllocator = new PlanNodeIdAllocator();
PlanVariableAllocator variableAllocator = new PlanVariableAllocator();
CachingStatsProvider statsProvider = new CachingStatsProvider(queryRunner.getStatsCalculator(), Optional.empty(), noLookup(), queryRunner.getDefaultSession(), variableAllocator.getTypes());
CachingCostProvider costProvider = new CachingCostProvider(queryRunner.getCostCalculator(), statsProvider, Optional.empty(), queryRunner.getDefaultSession());
return new Rule.Context() {
@Override
public Lookup getLookup() {
return noLookup();
}
@Override
public PlanNodeIdAllocator getIdAllocator() {
return planNodeIdAllocator;
}
@Override
public PlanVariableAllocator getVariableAllocator() {
return variableAllocator;
}
@Override
public Session getSession() {
return queryRunner.getDefaultSession();
}
@Override
public StatsProvider getStatsProvider() {
return statsProvider;
}
@Override
public CostProvider getCostProvider() {
return costProvider;
}
@Override
public void checkTimeoutNotExhausted() {
}
@Override
public WarningCollector getWarningCollector() {
return WarningCollector.NOOP;
}
};
}
use of com.facebook.presto.cost.CachingCostProvider in project presto by prestodb.
the class RuleAssert method formatPlan.
private String formatPlan(PlanNode plan, TypeProvider types) {
StatsProvider statsProvider = new CachingStatsProvider(statsCalculator, session, types);
CostProvider costProvider = new CachingCostProvider(costCalculator, statsProvider, session);
return inTransaction(session -> textLogicalPlan(translateExpressions(plan, types), types, metadata.getFunctionAndTypeManager(), StatsAndCosts.create(plan, statsProvider, costProvider), session, 2, false));
}
Aggregations