Search in sources :

Example 6 with MergeReceivePlanNode

use of org.voltdb.plannodes.MergeReceivePlanNode in project voltdb by VoltDB.

the class TestPlansOrderBy method validateAggregatedMergeReceive.

private void validateAggregatedMergeReceive(AbstractPlanNode pn, boolean hasSerialAggr, boolean hasPartialAggr, boolean hasProj, boolean hasLimit) {
    assertEquals(PlanNodeType.MERGERECEIVE, pn.getPlanNodeType());
    MergeReceivePlanNode rpn = (MergeReceivePlanNode) pn;
    assertNotNull(rpn.getInlinePlanNode(PlanNodeType.ORDERBY));
    assertEquals(hasSerialAggr, rpn.getInlinePlanNode(PlanNodeType.AGGREGATE) != null);
    assertEquals(hasPartialAggr, rpn.getInlinePlanNode(PlanNodeType.PARTIALAGGREGATE) != null);
    assertEquals(hasProj, rpn.getInlinePlanNode(PlanNodeType.PROJECTION) != null);
    if (hasSerialAggr || hasPartialAggr) {
        AbstractPlanNode aggrNode = (hasSerialAggr) ? rpn.getInlinePlanNode(PlanNodeType.AGGREGATE) : rpn.getInlinePlanNode(PlanNodeType.PARTIALAGGREGATE);
        assertEquals(hasLimit, aggrNode.getInlinePlanNode(PlanNodeType.LIMIT) != null);
    } else {
        assertEquals(hasLimit, rpn.getInlinePlanNode(PlanNodeType.LIMIT) != null);
    }
}
Also used : AbstractPlanNode(org.voltdb.plannodes.AbstractPlanNode) MergeReceivePlanNode(org.voltdb.plannodes.MergeReceivePlanNode)

Example 7 with MergeReceivePlanNode

use of org.voltdb.plannodes.MergeReceivePlanNode in project voltdb by VoltDB.

the class TestPlansOrderBy method validateMergeReceive.

private void validateMergeReceive(AbstractPlanNode pn, boolean hasLimit, int[] sortColumnIdx) {
    assertEquals(PlanNodeType.MERGERECEIVE, pn.getPlanNodeType());
    MergeReceivePlanNode rpn = (MergeReceivePlanNode) pn;
    assertNotNull(rpn.getInlinePlanNode(PlanNodeType.ORDERBY));
    assertEquals(hasLimit, rpn.getInlinePlanNode(PlanNodeType.LIMIT) != null);
    OrderByPlanNode opn = (OrderByPlanNode) rpn.getInlinePlanNode(PlanNodeType.ORDERBY);
    List<AbstractExpression> ses = opn.getSortExpressions();
    assertEquals(sortColumnIdx.length, ses.size());
    int idx = 0;
    List<AbstractExpression> sesTves = new ArrayList<>();
    for (AbstractExpression se : ses) {
        sesTves.addAll(se.findAllTupleValueSubexpressions());
    }
    assertEquals(sortColumnIdx.length, sesTves.size());
    for (AbstractExpression seTve : sesTves) {
        assertEquals(sortColumnIdx[idx++], ((TupleValueExpression) seTve).getColumnIndex());
    }
}
Also used : AbstractExpression(org.voltdb.expressions.AbstractExpression) OrderByPlanNode(org.voltdb.plannodes.OrderByPlanNode) ArrayList(java.util.ArrayList) MergeReceivePlanNode(org.voltdb.plannodes.MergeReceivePlanNode)

Example 8 with MergeReceivePlanNode

use of org.voltdb.plannodes.MergeReceivePlanNode in project voltdb by VoltDB.

the class TestPlansLimit method checkInlineLimitAndOrderbyWithReceive.

private void checkInlineLimitAndOrderbyWithReceive(List<AbstractPlanNode> pns, boolean pushdown) {
    AbstractPlanNode p;
    p = pns.get(0).getChild(0);
    assertTrue(p instanceof ProjectionPlanNode);
    p = p.getChild(0);
    assertTrue(p instanceof MergeReceivePlanNode);
    assertNotNull(p.getInlinePlanNode(PlanNodeType.LIMIT));
    assertNotNull(p.getInlinePlanNode(PlanNodeType.ORDERBY));
    if (pushdown) {
        assertEquals(2, pns.size());
        p = pns.get(1).getChild(0);
        assertTrue(p instanceof OrderByPlanNode);
        assertNotNull(p.getInlinePlanNode(PlanNodeType.LIMIT));
    } else if (pns.size() == 2) {
        p = pns.get(1).getChild(0);
        assertFalse(p.toExplainPlanString().toLowerCase().contains("limit"));
    }
}
Also used : AbstractPlanNode(org.voltdb.plannodes.AbstractPlanNode) OrderByPlanNode(org.voltdb.plannodes.OrderByPlanNode) MergeReceivePlanNode(org.voltdb.plannodes.MergeReceivePlanNode) ProjectionPlanNode(org.voltdb.plannodes.ProjectionPlanNode)

Aggregations

MergeReceivePlanNode (org.voltdb.plannodes.MergeReceivePlanNode)8 AbstractPlanNode (org.voltdb.plannodes.AbstractPlanNode)7 OrderByPlanNode (org.voltdb.plannodes.OrderByPlanNode)6 ProjectionPlanNode (org.voltdb.plannodes.ProjectionPlanNode)4 SendPlanNode (org.voltdb.plannodes.SendPlanNode)3 ReceivePlanNode (org.voltdb.plannodes.ReceivePlanNode)2 ArrayList (java.util.ArrayList)1 AbstractExpression (org.voltdb.expressions.AbstractExpression)1 AbstractScanPlanNode (org.voltdb.plannodes.AbstractScanPlanNode)1 AggregatePlanNode (org.voltdb.plannodes.AggregatePlanNode)1 HashAggregatePlanNode (org.voltdb.plannodes.HashAggregatePlanNode)1 IndexSortablePlanNode (org.voltdb.plannodes.IndexSortablePlanNode)1 LimitPlanNode (org.voltdb.plannodes.LimitPlanNode)1 NestLoopPlanNode (org.voltdb.plannodes.NestLoopPlanNode)1 PlanNodeType (org.voltdb.types.PlanNodeType)1