Search in sources :

Example 6 with PlanNode

use of io.prestosql.spi.plan.PlanNode in project hetu-core by openlookeng.

the class TestExternalFunctionPushDownChecker method testSpatialJoinNode.

@Test
public void testSpatialJoinNode() {
    PlanNode node = new SpatialJoinNode(idAllocator.getNextId(), SpatialJoinNode.Type.INNER, builder.values(columnA), builder.values(columnB), ImmutableList.of(columnB, columnA), sumCall, Optional.empty(), Optional.empty(), Optional.empty());
    validatePlan(node);
}
Also used : PlanNode(io.prestosql.spi.plan.PlanNode) SpatialJoinNode(io.prestosql.sql.planner.plan.SpatialJoinNode) Test(org.testng.annotations.Test) BasePlanTest(io.prestosql.sql.planner.assertions.BasePlanTest)

Example 7 with PlanNode

use of io.prestosql.spi.plan.PlanNode in project hetu-core by openlookeng.

the class TestExternalFunctionPushDownChecker method testTableWriterNodeWithExternalCall.

@Test(expectedExceptions = ExternalFunctionPushDownChecker.IllegalExternalFunctionUsageException.class, expectedExceptionsMessageRegExp = "The external function jdbc.v1.foo does not support to push down to data source for this query.")
public void testTableWriterNodeWithExternalCall() {
    TableWriterNode.DeleteTarget deleteTarget = new TableWriterNode.DeleteTarget(tableHandle, new SchemaTableName("sch", "tab"));
    PlanNode node = new TableWriterNode(idAllocator.getNextId(), builder.values(), deleteTarget, columnA, columnB, ImmutableList.of(columnA, columnB), ImmutableList.of("a", "b"), Optional.empty(), Optional.of(new StatisticAggregations(ImmutableMap.of(columnA, new AggregationNode.Aggregation(externalFooCall1, externalFooCall1.getArguments(), false, Optional.empty(), Optional.empty(), Optional.empty())), ImmutableList.of(columnA))), Optional.of(new StatisticAggregationsDescriptor<>(ImmutableMap.of(), ImmutableMap.of(), ImmutableMap.of())));
    validatePlan(node);
}
Also used : PlanNode(io.prestosql.spi.plan.PlanNode) StatisticAggregationsDescriptor(io.prestosql.sql.planner.plan.StatisticAggregationsDescriptor) TableWriterNode(io.prestosql.sql.planner.plan.TableWriterNode) SchemaTableName(io.prestosql.spi.connector.SchemaTableName) StatisticAggregations(io.prestosql.sql.planner.plan.StatisticAggregations) Test(org.testng.annotations.Test) BasePlanTest(io.prestosql.sql.planner.assertions.BasePlanTest)

Example 8 with PlanNode

use of io.prestosql.spi.plan.PlanNode in project hetu-core by openlookeng.

the class TestExternalFunctionPushDownChecker method testTableWriterNode.

@Test
public void testTableWriterNode() {
    TableWriterNode.DeleteTarget deleteTarget = new TableWriterNode.DeleteTarget(tableHandle, new SchemaTableName("sch", "tab"));
    PlanNode node = new TableWriterNode(idAllocator.getNextId(), builder.values(), deleteTarget, columnA, columnB, ImmutableList.of(columnA, columnB), ImmutableList.of("a", "b"), Optional.empty(), Optional.of(new StatisticAggregations(ImmutableMap.of(columnA, new AggregationNode.Aggregation(sumCall, sumCall.getArguments(), false, Optional.empty(), Optional.empty(), Optional.empty())), ImmutableList.of(columnA))), Optional.of(new StatisticAggregationsDescriptor<>(ImmutableMap.of(), ImmutableMap.of(), ImmutableMap.of())));
    validatePlan(node);
}
Also used : PlanNode(io.prestosql.spi.plan.PlanNode) StatisticAggregationsDescriptor(io.prestosql.sql.planner.plan.StatisticAggregationsDescriptor) TableWriterNode(io.prestosql.sql.planner.plan.TableWriterNode) SchemaTableName(io.prestosql.spi.connector.SchemaTableName) StatisticAggregations(io.prestosql.sql.planner.plan.StatisticAggregations) Test(org.testng.annotations.Test) BasePlanTest(io.prestosql.sql.planner.assertions.BasePlanTest)

Example 9 with PlanNode

use of io.prestosql.spi.plan.PlanNode in project hetu-core by openlookeng.

the class TestExternalFunctionPushDownChecker method testVacuumTableNode.

@Test
public void testVacuumTableNode() {
    TableWriterNode.DeleteTarget deleteTarget = new TableWriterNode.DeleteTarget(tableHandle, new SchemaTableName("sch", "tab"));
    PlanNode node = new VacuumTableNode(idAllocator.getNextId(), tableHandle, deleteTarget, columnA, columnB, "p1", false, ImmutableList.of(), Optional.of(new StatisticAggregations(ImmutableMap.of(columnA, new AggregationNode.Aggregation(sumCall, sumCall.getArguments(), false, Optional.empty(), Optional.empty(), Optional.empty())), ImmutableList.of(columnA))), Optional.of(new StatisticAggregationsDescriptor<>(ImmutableMap.of(), ImmutableMap.of(), ImmutableMap.of())));
    validatePlan(node);
}
Also used : PlanNode(io.prestosql.spi.plan.PlanNode) VacuumTableNode(io.prestosql.sql.planner.plan.VacuumTableNode) StatisticAggregationsDescriptor(io.prestosql.sql.planner.plan.StatisticAggregationsDescriptor) TableWriterNode(io.prestosql.sql.planner.plan.TableWriterNode) SchemaTableName(io.prestosql.spi.connector.SchemaTableName) StatisticAggregations(io.prestosql.sql.planner.plan.StatisticAggregations) Test(org.testng.annotations.Test) BasePlanTest(io.prestosql.sql.planner.assertions.BasePlanTest)

Example 10 with PlanNode

use of io.prestosql.spi.plan.PlanNode in project hetu-core by openlookeng.

the class TestExternalFunctionPushDownChecker method testFilterNodeWithExternalCallMultiple.

@Test(expectedExceptions = ExternalFunctionPushDownChecker.IllegalExternalFunctionUsageException.class, expectedExceptionsMessageRegExp = "The external function jdbc.v1.foo, jdbc.v1.foo2 does not support to push down to data source for this query.")
public void testFilterNodeWithExternalCallMultiple() {
    PlanNode root = builder.filter(externalFooCall1, builder.filter(externalFooCall2, builder.values(columnA)));
    validatePlan(root);
}
Also used : PlanNode(io.prestosql.spi.plan.PlanNode) Test(org.testng.annotations.Test) BasePlanTest(io.prestosql.sql.planner.assertions.BasePlanTest)

Aggregations

PlanNode (io.prestosql.spi.plan.PlanNode)236 Symbol (io.prestosql.spi.plan.Symbol)95 Test (org.testng.annotations.Test)95 ImmutableList (com.google.common.collect.ImmutableList)49 RowExpression (io.prestosql.spi.relation.RowExpression)48 Expression (io.prestosql.sql.tree.Expression)46 ProjectNode (io.prestosql.spi.plan.ProjectNode)45 JoinNode (io.prestosql.spi.plan.JoinNode)42 Optional (java.util.Optional)42 OriginalExpressionUtils.castToRowExpression (io.prestosql.sql.relational.OriginalExpressionUtils.castToRowExpression)41 TableScanNode (io.prestosql.spi.plan.TableScanNode)40 CallExpression (io.prestosql.spi.relation.CallExpression)38 List (java.util.List)38 ImmutableMap (com.google.common.collect.ImmutableMap)37 FilterNode (io.prestosql.spi.plan.FilterNode)37 Map (java.util.Map)35 BasePlanTest (io.prestosql.sql.planner.assertions.BasePlanTest)34 AggregationNode (io.prestosql.spi.plan.AggregationNode)33 Assignments (io.prestosql.spi.plan.Assignments)32 ComparisonExpression (io.prestosql.sql.tree.ComparisonExpression)32