Search in sources :

Example 1 with ExplainAnalyzeNode

use of io.prestosql.sql.planner.plan.ExplainAnalyzeNode in project hetu-core by openlookeng.

the class TestVerifyOnlyOneOutputNode method testValidateFailed.

@Test(expectedExceptions = IllegalStateException.class)
public void testValidateFailed() {
    // random plan with 2 output nodes
    PlanNode root = new OutputNode(idAllocator.getNextId(), new ExplainAnalyzeNode(idAllocator.getNextId(), new OutputNode(idAllocator.getNextId(), new ProjectNode(idAllocator.getNextId(), new ValuesNode(idAllocator.getNextId(), ImmutableList.of(), ImmutableList.of()), Assignments.of()), ImmutableList.of(), ImmutableList.of()), new Symbol("a"), false), ImmutableList.of(), ImmutableList.of());
    new VerifyOnlyOneOutputNode().validate(root, null, null, null, null, WarningCollector.NOOP);
}
Also used : ValuesNode(io.prestosql.spi.plan.ValuesNode) OutputNode(io.prestosql.sql.planner.plan.OutputNode) PlanNode(io.prestosql.spi.plan.PlanNode) ExplainAnalyzeNode(io.prestosql.sql.planner.plan.ExplainAnalyzeNode) Symbol(io.prestosql.spi.plan.Symbol) ProjectNode(io.prestosql.spi.plan.ProjectNode) Test(org.testng.annotations.Test)

Example 2 with ExplainAnalyzeNode

use of io.prestosql.sql.planner.plan.ExplainAnalyzeNode in project hetu-core by openlookeng.

the class LogicalPlanner method createExplainAnalyzePlan.

private RelationPlan createExplainAnalyzePlan(Analysis analysis, Explain statement) {
    RelationPlan underlyingPlan = planStatementWithoutOutput(analysis, statement.getStatement());
    PlanNode root = underlyingPlan.getRoot();
    Scope scope = analysis.getScope(statement);
    Symbol outputSymbol = planSymbolAllocator.newSymbol(scope.getRelationType().getFieldByIndex(0));
    root = new ExplainAnalyzeNode(idAllocator.getNextId(), root, outputSymbol, statement.isVerbose());
    return new RelationPlan(root, scope, ImmutableList.of(outputSymbol));
}
Also used : PlanNode(io.prestosql.spi.plan.PlanNode) Scope(io.prestosql.sql.analyzer.Scope) ExplainAnalyzeNode(io.prestosql.sql.planner.plan.ExplainAnalyzeNode) Symbol(io.prestosql.spi.plan.Symbol)

Aggregations

PlanNode (io.prestosql.spi.plan.PlanNode)2 Symbol (io.prestosql.spi.plan.Symbol)2 ExplainAnalyzeNode (io.prestosql.sql.planner.plan.ExplainAnalyzeNode)2 ProjectNode (io.prestosql.spi.plan.ProjectNode)1 ValuesNode (io.prestosql.spi.plan.ValuesNode)1 Scope (io.prestosql.sql.analyzer.Scope)1 OutputNode (io.prestosql.sql.planner.plan.OutputNode)1 Test (org.testng.annotations.Test)1