Search in sources :

Example 1 with CachingStatsProvider

use of io.trino.cost.CachingStatsProvider in project trino by trinodb.

the class TestJoinEnumerator method createContext.

private Rule.Context createContext() {
    PlanNodeIdAllocator planNodeIdAllocator = new PlanNodeIdAllocator();
    SymbolAllocator symbolAllocator = new SymbolAllocator();
    CachingStatsProvider statsProvider = new CachingStatsProvider(queryRunner.getStatsCalculator(), Optional.empty(), noLookup(), queryRunner.getDefaultSession(), symbolAllocator.getTypes());
    CachingCostProvider costProvider = new CachingCostProvider(queryRunner.getCostCalculator(), statsProvider, Optional.empty(), queryRunner.getDefaultSession(), symbolAllocator.getTypes());
    return new Rule.Context() {

        @Override
        public Lookup getLookup() {
            return noLookup();
        }

        @Override
        public PlanNodeIdAllocator getIdAllocator() {
            return planNodeIdAllocator;
        }

        @Override
        public SymbolAllocator getSymbolAllocator() {
            return symbolAllocator;
        }

        @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 : SymbolAllocator(io.trino.sql.planner.SymbolAllocator) CachingStatsProvider(io.trino.cost.CachingStatsProvider) PlanNodeIdAllocator(io.trino.sql.planner.PlanNodeIdAllocator) CachingCostProvider(io.trino.cost.CachingCostProvider)

Example 2 with CachingStatsProvider

use of io.trino.cost.CachingStatsProvider in project trino by trinodb.

the class RuleAssert method formatPlan.

private String formatPlan(PlanNode plan, TypeProvider types) {
    return inTransaction(session -> {
        StatsProvider statsProvider = new CachingStatsProvider(statsCalculator, session, types);
        CostProvider costProvider = new CachingCostProvider(costCalculator, statsProvider, session, types);
        return textLogicalPlan(plan, types, metadata, functionManager, StatsAndCosts.create(plan, statsProvider, costProvider), session, 2, false);
    });
}
Also used : CachingStatsProvider(io.trino.cost.CachingStatsProvider) StatsProvider(io.trino.cost.StatsProvider) CachingStatsProvider(io.trino.cost.CachingStatsProvider) CachingCostProvider(io.trino.cost.CachingCostProvider) CostProvider(io.trino.cost.CostProvider) CachingCostProvider(io.trino.cost.CachingCostProvider)

Example 3 with CachingStatsProvider

use of io.trino.cost.CachingStatsProvider in project trino by trinodb.

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.symbolAllocator.getTypes());
    CostProvider costProvider = new CachingCostProvider(costCalculator, statsProvider, Optional.of(context.memo), context.session, context.symbolAllocator.getTypes());
    return new Rule.Context() {

        @Override
        public Lookup getLookup() {
            return context.lookup;
        }

        @Override
        public PlanNodeIdAllocator getIdAllocator() {
            return context.idAllocator;
        }

        @Override
        public SymbolAllocator getSymbolAllocator() {
            return context.symbolAllocator;
        }

        @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 : PlannerContext(io.trino.sql.PlannerContext) CachingStatsProvider(io.trino.cost.CachingStatsProvider) StatsProvider(io.trino.cost.StatsProvider) CachingStatsProvider(io.trino.cost.CachingStatsProvider) CachingCostProvider(io.trino.cost.CachingCostProvider) CostProvider(io.trino.cost.CostProvider) CachingCostProvider(io.trino.cost.CachingCostProvider)

Example 4 with CachingStatsProvider

use of io.trino.cost.CachingStatsProvider in project trino by trinodb.

the class RuleAssert method ruleContext.

private Rule.Context ruleContext(StatsCalculator statsCalculator, CostCalculator costCalculator, SymbolAllocator symbolAllocator, Memo memo, Lookup lookup, Session session) {
    StatsProvider statsProvider = new CachingStatsProvider(statsCalculator, Optional.of(memo), lookup, session, symbolAllocator.getTypes());
    CostProvider costProvider = new CachingCostProvider(costCalculator, statsProvider, Optional.of(memo), session, symbolAllocator.getTypes());
    return new Rule.Context() {

        @Override
        public Lookup getLookup() {
            return lookup;
        }

        @Override
        public PlanNodeIdAllocator getIdAllocator() {
            return idAllocator;
        }

        @Override
        public SymbolAllocator getSymbolAllocator() {
            return symbolAllocator;
        }

        @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(io.trino.cost.CachingStatsProvider) StatsProvider(io.trino.cost.StatsProvider) CachingStatsProvider(io.trino.cost.CachingStatsProvider) CachingCostProvider(io.trino.cost.CachingCostProvider) CostProvider(io.trino.cost.CostProvider) CachingCostProvider(io.trino.cost.CachingCostProvider)

Example 5 with CachingStatsProvider

use of io.trino.cost.CachingStatsProvider in project trino by trinodb.

the class PlanAssert method assertPlan.

public static void assertPlan(Session session, Metadata metadata, FunctionManager functionManager, StatsCalculator statsCalculator, Plan actual, Lookup lookup, PlanMatchPattern pattern) {
    StatsProvider statsProvider = new CachingStatsProvider(statsCalculator, session, actual.getTypes());
    assertPlan(session, metadata, functionManager, statsProvider, actual, lookup, pattern);
}
Also used : CachingStatsProvider(io.trino.cost.CachingStatsProvider) StatsProvider(io.trino.cost.StatsProvider) CachingStatsProvider(io.trino.cost.CachingStatsProvider)

Aggregations

CachingStatsProvider (io.trino.cost.CachingStatsProvider)6 CachingCostProvider (io.trino.cost.CachingCostProvider)5 StatsProvider (io.trino.cost.StatsProvider)5 CostProvider (io.trino.cost.CostProvider)4 StatsAndCosts (io.trino.cost.StatsAndCosts)1 PlannerContext (io.trino.sql.PlannerContext)1 PlanNodeIdAllocator (io.trino.sql.planner.PlanNodeIdAllocator)1 SymbolAllocator (io.trino.sql.planner.SymbolAllocator)1 PlanOptimizer (io.trino.sql.planner.optimizations.PlanOptimizer)1 PlanNode (io.trino.sql.planner.plan.PlanNode)1