Package org.voltdb.plannodes

Examples of org.voltdb.plannodes.DeletePlanNode


        AbstractPlanNode subSelectRoot = subAssembler.nextPlan();
        if (subSelectRoot == null)
            return null;

        // generate the delete node with the right target table
        DeletePlanNode deleteNode = new DeletePlanNode(m_context, getNextPlanNodeId());
        deleteNode.setTargetTableName(targetTable.getTypeName());

        ProjectionPlanNode projectionNode = new ProjectionPlanNode(m_context, getNextPlanNodeId());
        AbstractExpression addressExpr = new TupleAddressExpression();
        PlanColumn colInfo = m_context.getPlanColumn(addressExpr, "tuple_address");
        projectionNode.appendOutputColumn(colInfo);

        if (m_singlePartition == true) {

            assert(subSelectRoot instanceof AbstractScanPlanNode);

            // if the scan below matches all nodes, we can throw away the scan
            // nodes and use a truncate delete node
            if ((subSelectRoot instanceof SeqScanPlanNode)
                    && (((AbstractScanPlanNode) subSelectRoot).getPredicate() == null)) {
                deleteNode.setTruncate(true);
                return deleteNode;
            }

            // OPTIMIZATION: Projection Inline
            // If the root node we got back from createSelectTree() is an
            // AbstractScanNode, then
            // we put the Projection node we just created inside of it
            subSelectRoot.addInlinePlanNode(projectionNode);
            // connect the nodes to build the graph
            deleteNode.addAndLinkChild(subSelectRoot);

            // XXX: PAVLO
            if (INCLUDE_SEND_FOR_ALL) {
                SendPlanNode sendNode = new SendPlanNode(m_context, getNextPlanNodeId());
                sendNode.setFake(true);
                sendNode.addAndLinkChild(deleteNode);
                sendNode.setOutputColumns(deleteNode.getOutputColumnGUIDs());
                return sendNode;
            } else {
                return deleteNode;
            }
        } else {
            // make sure the thing we have is a receive node which
            // indicates it's a multi-site plan
            assert (subSelectRoot instanceof ReceivePlanNode);

            //
            // put the delete node in the right place
            //

            // get the recv node
            ReceivePlanNode recvNode = (ReceivePlanNode) subSelectRoot;
            // get the send node
            assert (recvNode.getChildPlanNodeCount() == 1);
            AbstractPlanNode sendNode = recvNode.getChild(0);

            // get the scan node and unlink
            assert (sendNode.getChildPlanNodeCount() == 1);
            AbstractPlanNode scanNode = sendNode.getChild(0);
            sendNode.unlinkChild(scanNode);

            // link in the delete node
            assert (scanNode instanceof AbstractScanPlanNode);
            scanNode.addInlinePlanNode(projectionNode);
            deleteNode.addAndLinkChild(scanNode);

            AbstractPlanNode combineNode = insertCountInDMLPlan(deleteNode);
            sendNode.addAndLinkChild(combineNode);

            // fix the receive node's output columns
View Full Code Here


            // simply jumps ahead to the next plan (if any).
            return getNextDeletePlan();
        }

        // generate the delete node with the right target table
        DeletePlanNode deleteNode = new DeletePlanNode();
        deleteNode.setTargetTableName(targetTable.getTypeName());

        ProjectionPlanNode projectionNode = new ProjectionPlanNode();
        AbstractExpression addressExpr = new TupleAddressExpression();
        NodeSchema proj_schema = new NodeSchema();
        // This planner-created column is magic.
        proj_schema.addColumn(new SchemaColumn("VOLT_TEMP_TABLE",
                                               "VOLT_TEMP_TABLE",
                                               "tuple_address",
                                               "tuple_address",
                                               addressExpr));
        projectionNode.setOutputSchema(proj_schema);

        assert(subSelectRoot instanceof AbstractScanPlanNode);

        // If the scan matches all rows, we can throw away the scan
        // nodes and use a truncate delete node.
        // Assume all index scans have filters in this context, so only consider seq scans.
        if ( (subSelectRoot instanceof SeqScanPlanNode) &&
                (((SeqScanPlanNode) subSelectRoot).getPredicate() == null)) {
            deleteNode.setTruncate(true);

            if (m_partitioning.wasSpecifiedAsSingle()) {
                return deleteNode;
            }
        } else {
            // connect the nodes to build the graph
            deleteNode.addAndLinkChild(subSelectRoot);
            // OPTIMIZATION: Projection Inline
            // If the root node we got back from createSelectTree() is an
            // AbstractScanNode, then
            // we put the Projection node we just created inside of it
            // When we inline this projection into the scan, we're going
View Full Code Here

TOP

Related Classes of org.voltdb.plannodes.DeletePlanNode

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.