Search in sources :

Example 21 with ProjectNode

use of com.facebook.presto.sql.planner.plan.ProjectNode in project presto by prestodb.

the class TestTypeValidator method testValidTypeOnlyCoercion.

@Test
public void testValidTypeOnlyCoercion() throws Exception {
    Expression expression = new Cast(columnB.toSymbolReference(), StandardTypes.BIGINT);
    Assignments assignments = Assignments.builder().put(symbolAllocator.newSymbol(expression, BIGINT), expression).put(symbolAllocator.newSymbol(columnE.toSymbolReference(), VARCHAR), // implicit coercion from varchar(3) to varchar
    columnE.toSymbolReference()).build();
    PlanNode node = new ProjectNode(newId(), baseTableScan, assignments);
    assertTypesValid(node);
}
Also used : Cast(com.facebook.presto.sql.tree.Cast) PlanNode(com.facebook.presto.sql.planner.plan.PlanNode) Expression(com.facebook.presto.sql.tree.Expression) Assignments(com.facebook.presto.sql.planner.plan.Assignments) ProjectNode(com.facebook.presto.sql.planner.plan.ProjectNode) Test(org.testng.annotations.Test)

Aggregations

ProjectNode (com.facebook.presto.sql.planner.plan.ProjectNode)21 Expression (com.facebook.presto.sql.tree.Expression)14 Assignments (com.facebook.presto.sql.planner.plan.Assignments)11 PlanNode (com.facebook.presto.sql.planner.plan.PlanNode)11 Symbol (com.facebook.presto.sql.planner.Symbol)7 Cast (com.facebook.presto.sql.tree.Cast)7 Test (org.testng.annotations.Test)7 AggregationNode (com.facebook.presto.sql.planner.plan.AggregationNode)5 ValuesNode (com.facebook.presto.sql.planner.plan.ValuesNode)5 ImmutableList (com.google.common.collect.ImmutableList)5 List (java.util.List)5 ComparisonExpression (com.facebook.presto.sql.tree.ComparisonExpression)4 FunctionCall (com.facebook.presto.sql.tree.FunctionCall)4 ImmutableMap (com.google.common.collect.ImmutableMap)4 Map (java.util.Map)4 Signature (com.facebook.presto.metadata.Signature)3 Type (com.facebook.presto.spi.type.Type)3 Field (com.facebook.presto.sql.analyzer.Field)3 RelationType (com.facebook.presto.sql.analyzer.RelationType)3 LimitNode (com.facebook.presto.sql.planner.plan.LimitNode)3