Search in sources :

Example 1 with CachingStatsProvider

use of com.facebook.presto.cost.CachingStatsProvider in project presto by prestodb.

the class PlanAssert method assertPlan.

public static void assertPlan(Session session, Metadata metadata, StatsCalculator statsCalculator, Plan actual, PlanMatchPattern pattern) {
    StatsProvider statsProvider = new CachingStatsProvider(statsCalculator, session, actual.getTypes());
    assertPlan(session, metadata, statsProvider, actual, noLookup(), pattern, Function.identity());
}
Also used : CachingStatsProvider(com.facebook.presto.cost.CachingStatsProvider) StatsProvider(com.facebook.presto.cost.StatsProvider) CachingStatsProvider(com.facebook.presto.cost.CachingStatsProvider)

Example 2 with CachingStatsProvider

use of com.facebook.presto.cost.CachingStatsProvider 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;
        }
    };
}
Also used : CachingStatsProvider(com.facebook.presto.cost.CachingStatsProvider) CachingStatsProvider(com.facebook.presto.cost.CachingStatsProvider) StatsProvider(com.facebook.presto.cost.StatsProvider) CachingCostProvider(com.facebook.presto.cost.CachingCostProvider) CachingCostProvider(com.facebook.presto.cost.CachingCostProvider) CostProvider(com.facebook.presto.cost.CostProvider)

Example 3 with CachingStatsProvider

use of com.facebook.presto.cost.CachingStatsProvider 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;
        }
    };
}
Also used : CachingStatsProvider(com.facebook.presto.cost.CachingStatsProvider) CachingStatsProvider(com.facebook.presto.cost.CachingStatsProvider) StatsProvider(com.facebook.presto.cost.StatsProvider) CachingCostProvider(com.facebook.presto.cost.CachingCostProvider) CachingCostProvider(com.facebook.presto.cost.CachingCostProvider) CostProvider(com.facebook.presto.cost.CostProvider)

Example 4 with CachingStatsProvider

use of com.facebook.presto.cost.CachingStatsProvider 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();
}
Also used : CachingStatsProvider(com.facebook.presto.cost.CachingStatsProvider) CachingStatsProvider(com.facebook.presto.cost.CachingStatsProvider) StatsProvider(com.facebook.presto.cost.StatsProvider) SemiJoinNode(com.facebook.presto.sql.planner.plan.SemiJoinNode) JoinNode(com.facebook.presto.sql.planner.plan.JoinNode) CachingCostProvider(com.facebook.presto.cost.CachingCostProvider) CostProvider(com.facebook.presto.cost.CostProvider) CachingCostProvider(com.facebook.presto.cost.CachingCostProvider) SemiJoinNode(com.facebook.presto.sql.planner.plan.SemiJoinNode)

Example 5 with CachingStatsProvider

use of com.facebook.presto.cost.CachingStatsProvider 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;
        }
    };
}
Also used : CachingStatsProvider(com.facebook.presto.cost.CachingStatsProvider) PlanNodeIdAllocator(com.facebook.presto.spi.plan.PlanNodeIdAllocator) CachingCostProvider(com.facebook.presto.cost.CachingCostProvider) PlanVariableAllocator(com.facebook.presto.sql.planner.PlanVariableAllocator)

Aggregations

CachingStatsProvider (com.facebook.presto.cost.CachingStatsProvider)6 CachingCostProvider (com.facebook.presto.cost.CachingCostProvider)5 StatsProvider (com.facebook.presto.cost.StatsProvider)5 CostProvider (com.facebook.presto.cost.CostProvider)4 PlanNodeIdAllocator (com.facebook.presto.spi.plan.PlanNodeIdAllocator)1 PlanVariableAllocator (com.facebook.presto.sql.planner.PlanVariableAllocator)1 JoinNode (com.facebook.presto.sql.planner.plan.JoinNode)1 SemiJoinNode (com.facebook.presto.sql.planner.plan.SemiJoinNode)1