Search in sources :

Example 36 with ValuesNode

use of io.trino.sql.planner.plan.ValuesNode in project trino by trinodb.

the class LogicalPlanner method planStatement.

public PlanNode planStatement(Analysis analysis, Statement statement) {
    if ((statement instanceof CreateTableAsSelect && analysis.getCreate().orElseThrow().isCreateTableAsSelectNoOp()) || statement instanceof RefreshMaterializedView && analysis.isSkipMaterializedViewRefresh()) {
        Symbol symbol = symbolAllocator.newSymbol("rows", BIGINT);
        PlanNode source = new ValuesNode(idAllocator.getNextId(), ImmutableList.of(symbol), ImmutableList.of(new Row(ImmutableList.of(new GenericLiteral("BIGINT", "0")))));
        return new OutputNode(idAllocator.getNextId(), source, ImmutableList.of("rows"), ImmutableList.of(symbol));
    }
    return createOutputPlan(planStatementWithoutOutput(analysis, statement), analysis);
}
Also used : ValuesNode(io.trino.sql.planner.plan.ValuesNode) OutputNode(io.trino.sql.planner.plan.OutputNode) PlanNode(io.trino.sql.planner.plan.PlanNode) RefreshMaterializedView(io.trino.sql.tree.RefreshMaterializedView) CreateTableAsSelect(io.trino.sql.tree.CreateTableAsSelect) Row(io.trino.sql.tree.Row) GenericLiteral(io.trino.sql.tree.GenericLiteral)

Aggregations

ValuesNode (io.trino.sql.planner.plan.ValuesNode)36 Symbol (io.trino.sql.planner.Symbol)25 Expression (io.trino.sql.tree.Expression)15 PlanNode (io.trino.sql.planner.plan.PlanNode)14 Test (org.testng.annotations.Test)12 Row (io.trino.sql.tree.Row)11 JoinNode (io.trino.sql.planner.plan.JoinNode)10 ProjectNode (io.trino.sql.planner.plan.ProjectNode)10 ImmutableList (com.google.common.collect.ImmutableList)9 PlanNodeIdAllocator (io.trino.sql.planner.PlanNodeIdAllocator)8 PlanBuilder (io.trino.sql.planner.iterative.rule.test.PlanBuilder)8 FilterNode (io.trino.sql.planner.plan.FilterNode)8 ImmutableMap (com.google.common.collect.ImmutableMap)7 Session (io.trino.Session)7 MultiJoinNode (io.trino.sql.planner.iterative.rule.ReorderJoins.MultiJoinNode)7 MultiJoinNode.toMultiJoinNode (io.trino.sql.planner.iterative.rule.ReorderJoins.MultiJoinNode.toMultiJoinNode)7 List (java.util.List)7 Type (io.trino.spi.type.Type)6 DomainTranslator (io.trino.sql.planner.DomainTranslator)6 Map (java.util.Map)6