Search in sources :

Example 11 with PlanNodeStatsEstimate

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

the class MetricComparator method getEstimatedValuesInternal.

private static List<OptionalDouble> getEstimatedValuesInternal(List<Metric> metrics, String query, QueryRunner runner, Session session) // TODO inline back this method
{
    Plan queryPlan = runner.createPlan(session, query, WarningCollector.NOOP);
    OutputNode outputNode = (OutputNode) queryPlan.getRoot();
    PlanNodeStatsEstimate outputNodeStats = queryPlan.getStatsAndCosts().getStats().getOrDefault(queryPlan.getRoot().getId(), PlanNodeStatsEstimate.unknown());
    StatsContext statsContext = buildStatsContext(queryPlan, outputNode);
    return getEstimatedValues(metrics, outputNodeStats, statsContext);
}
Also used : OutputNode(com.facebook.presto.sql.planner.plan.OutputNode) PlanNodeStatsEstimate(com.facebook.presto.cost.PlanNodeStatsEstimate) Plan(com.facebook.presto.sql.planner.Plan)

Aggregations

PlanNodeStatsEstimate (com.facebook.presto.cost.PlanNodeStatsEstimate)11 ImmutableMap (com.google.common.collect.ImmutableMap)6 Optional (java.util.Optional)6 Test (org.testng.annotations.Test)6 JOIN_DISTRIBUTION_TYPE (com.facebook.presto.SystemSessionProperties.JOIN_DISTRIBUTION_TYPE)5 JOIN_MAX_BROADCAST_TABLE_SIZE (com.facebook.presto.SystemSessionProperties.JOIN_MAX_BROADCAST_TABLE_SIZE)5 BIGINT (com.facebook.presto.common.type.BigintType.BIGINT)5 CostComparator (com.facebook.presto.cost.CostComparator)5 VariableStatsEstimate (com.facebook.presto.cost.VariableStatsEstimate)5 PlanNodeId (com.facebook.presto.spi.plan.PlanNodeId)5 VariableReferenceExpression (com.facebook.presto.spi.relation.VariableReferenceExpression)5 JoinDistributionType (com.facebook.presto.sql.analyzer.FeaturesConfig.JoinDistributionType)5 PlanMatchPattern.values (com.facebook.presto.sql.planner.assertions.PlanMatchPattern.values)5 RuleAssert (com.facebook.presto.sql.planner.iterative.rule.test.RuleAssert)5 RuleTester (com.facebook.presto.sql.planner.iterative.rule.test.RuleTester)5 ImmutableList (com.google.common.collect.ImmutableList)5 AfterClass (org.testng.annotations.AfterClass)5 BeforeClass (org.testng.annotations.BeforeClass)5 PlanMatchPattern.equiJoinClause (com.facebook.presto.sql.planner.assertions.PlanMatchPattern.equiJoinClause)4 PlanMatchPattern.join (com.facebook.presto.sql.planner.assertions.PlanMatchPattern.join)4