Search in sources :

Example 26 with SendPlanNode

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

the class SubPlanAssembler method addSendReceivePair.

/**
     * Insert a send receive pair above the supplied scanNode.
     * @param scanNode that needs to be distributed
     * @return return the newly created receive node (which is linked to the new sends)
     */
protected static AbstractPlanNode addSendReceivePair(AbstractPlanNode scanNode) {
    SendPlanNode sendNode = new SendPlanNode();
    sendNode.addAndLinkChild(scanNode);
    ReceivePlanNode recvNode = new ReceivePlanNode();
    recvNode.addAndLinkChild(sendNode);
    return recvNode;
}
Also used : SendPlanNode(org.voltdb.plannodes.SendPlanNode) ReceivePlanNode(org.voltdb.plannodes.ReceivePlanNode)

Example 27 with SendPlanNode

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

the class QueryPlanner method fragmentize.

private static void fragmentize(CompiledPlan plan, AbstractReceivePlanNode recvNode) {
    assert (recvNode.getChildCount() == 1);
    AbstractPlanNode childNode = recvNode.getChild(0);
    assert (childNode instanceof SendPlanNode);
    SendPlanNode sendNode = (SendPlanNode) childNode;
    // disconnect the send and receive nodes
    sendNode.clearParents();
    recvNode.clearChildren();
    plan.subPlanGraph = sendNode;
    return;
}
Also used : AbstractPlanNode(org.voltdb.plannodes.AbstractPlanNode) SendPlanNode(org.voltdb.plannodes.SendPlanNode)

Example 28 with SendPlanNode

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

the class TestIndexReverseScan method checkForwardScan.

private void checkForwardScan(String indexName, IndexLookupType lookupType, int searchKeys, int endKeys, int predicates, SortDirectionType sortType, boolean needOrderby) {
    AbstractPlanNode pn = compile(sql);
    System.out.println(pn.toExplainPlanString());
    assertTrue(pn instanceof SendPlanNode);
    pn = pn.getChild(0);
    if (needOrderby) {
        assertTrue(pn instanceof ProjectionPlanNode);
        pn = pn.getChild(0);
        assertTrue(pn instanceof OrderByPlanNode);
        pn = pn.getChild(0);
    }
    assertTrue(pn instanceof IndexScanPlanNode);
    IndexScanPlanNode ispn = (IndexScanPlanNode) pn;
    assertTrue(ispn.getTargetIndexName().contains(indexName));
    assertEquals(lookupType, ispn.getLookupType());
    assertEquals(searchKeys, ispn.getSearchKeyExpressions().size());
    assertEquals(endKeys, ExpressionUtil.uncombinePredicate(ispn.getEndExpression()).size());
    assertEquals(predicates, ExpressionUtil.uncombinePredicate(ispn.getPredicate()).size());
    assertEquals(0, ExpressionUtil.uncombinePredicate(ispn.getInitialExpression()).size());
    assertEquals(sortType, ispn.getSortDirection());
}
Also used : AbstractPlanNode(org.voltdb.plannodes.AbstractPlanNode) OrderByPlanNode(org.voltdb.plannodes.OrderByPlanNode) SendPlanNode(org.voltdb.plannodes.SendPlanNode) IndexScanPlanNode(org.voltdb.plannodes.IndexScanPlanNode) ProjectionPlanNode(org.voltdb.plannodes.ProjectionPlanNode)

Example 29 with SendPlanNode

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

the class TestIndexReverseScan method checkReverseScan.

private void checkReverseScan(String indexName, IndexLookupType lookupType, int searchKeys, int endKeys, int predicates, int initials, boolean artificial, SortDirectionType sortType, boolean needOrderby) {
    AbstractPlanNode pn = compile(sql);
    System.out.println(pn.toExplainPlanString());
    assertTrue(pn instanceof SendPlanNode);
    pn = pn.getChild(0);
    if (needOrderby) {
        assertTrue(pn instanceof ProjectionPlanNode);
        pn = pn.getChild(0);
        assertTrue(pn instanceof OrderByPlanNode);
        pn = pn.getChild(0);
    }
    assertTrue(pn instanceof IndexScanPlanNode);
    IndexScanPlanNode ispn = (IndexScanPlanNode) pn;
    assertTrue(ispn.getTargetIndexName().contains(indexName));
    assertEquals(lookupType, ispn.getLookupType());
    assertEquals(searchKeys, ispn.getSearchKeyExpressions().size());
    assertEquals(endKeys, ExpressionUtil.uncombinePredicate(ispn.getEndExpression()).size());
    assertEquals(predicates, ExpressionUtil.uncombinePredicate(ispn.getPredicate()).size());
    assertEquals(initials, ExpressionUtil.uncombinePredicate(ispn.getInitialExpression()).size());
    // Test artificial post predicate
    if (predicates == 1 && artificial) {
        assertTrue(ispn.getPredicate().getExpressionType() == ExpressionType.OPERATOR_NOT);
        assertTrue(ispn.getPredicate().getLeft().getExpressionType() == ExpressionType.OPERATOR_IS_NULL);
    } else if (predicates > 1) {
        assertTrue(ispn.getPredicate().getExpressionType() == ExpressionType.CONJUNCTION_AND);
    }
    // SortDirection can be INVALID because we use LookupType to determine
    // index scan direction instead in EE.
    assertEquals(sortType, ispn.getSortDirection());
}
Also used : AbstractPlanNode(org.voltdb.plannodes.AbstractPlanNode) OrderByPlanNode(org.voltdb.plannodes.OrderByPlanNode) SendPlanNode(org.voltdb.plannodes.SendPlanNode) IndexScanPlanNode(org.voltdb.plannodes.IndexScanPlanNode) ProjectionPlanNode(org.voltdb.plannodes.ProjectionPlanNode)

Aggregations

SendPlanNode (org.voltdb.plannodes.SendPlanNode)29 AbstractPlanNode (org.voltdb.plannodes.AbstractPlanNode)27 ProjectionPlanNode (org.voltdb.plannodes.ProjectionPlanNode)16 ReceivePlanNode (org.voltdb.plannodes.ReceivePlanNode)12 MergeReceivePlanNode (org.voltdb.plannodes.MergeReceivePlanNode)11 OrderByPlanNode (org.voltdb.plannodes.OrderByPlanNode)9 HashAggregatePlanNode (org.voltdb.plannodes.HashAggregatePlanNode)8 NestLoopPlanNode (org.voltdb.plannodes.NestLoopPlanNode)8 AggregatePlanNode (org.voltdb.plannodes.AggregatePlanNode)6 AbstractReceivePlanNode (org.voltdb.plannodes.AbstractReceivePlanNode)4 IndexScanPlanNode (org.voltdb.plannodes.IndexScanPlanNode)4 NestLoopIndexPlanNode (org.voltdb.plannodes.NestLoopIndexPlanNode)4 LimitPlanNode (org.voltdb.plannodes.LimitPlanNode)3 NodeSchema (org.voltdb.plannodes.NodeSchema)3 SchemaColumn (org.voltdb.plannodes.SchemaColumn)3 SeqScanPlanNode (org.voltdb.plannodes.SeqScanPlanNode)3 WindowFunctionPlanNode (org.voltdb.plannodes.WindowFunctionPlanNode)3 JSONException (org.json_voltpatches.JSONException)2 AbstractJoinPlanNode (org.voltdb.plannodes.AbstractJoinPlanNode)2 FileNotFoundException (java.io.FileNotFoundException)1