Examples of SendPlanNode


Examples of org.voltdb.plannodes.SendPlanNode

        if (currentNode instanceof ReceivePlanNode) {
            ReceivePlanNode recvNode = (ReceivePlanNode) currentNode;
            assert(recvNode.getChildPlanNodeCount() == 1);
            AbstractPlanNode childNode = recvNode.getChild(0);
            assert(childNode instanceof SendPlanNode);
            SendPlanNode sendNode = (SendPlanNode) childNode;

            // disconnect the send and receive nodes
            sendNode.clearParents();
            recvNode.clearChildren();

            // make a new plan fragment rooted at the send
            CompiledPlan.Fragment subFrag = new CompiledPlan.Fragment();
View Full Code Here

Examples of org.voltdb.plannodes.SendPlanNode

        recv_node.getOutputColumnGUIDs().clear();
        recv_node.getOutputColumnGUIDs().addAll(clone_node.getOutputColumnGUIDs());
        state.markDirty(recv_node);

        assert (recv_node.getChild(0) instanceof SendPlanNode);
        SendPlanNode send_node = (SendPlanNode) recv_node.getChild(0);
        send_node.getOutputColumnGUIDs().clear();
        send_node.getOutputColumnGUIDs().addAll(clone_node.getOutputColumnGUIDs());
        send_node.addIntermediary(clone_node);
        state.markDirty(send_node);

        // 2011-12-08: We now need to correct the aggregate columns for the
        // original plan node
        if ((clone_node instanceof DistinctPlanNode) == false) {
View Full Code Here

Examples of org.voltdb.plannodes.SendPlanNode

     * @param scanNode that needs to be distributed
     * @return return the newly created receive node (which is linked to the new sends)
     */
    protected AbstractPlanNode addSendReceivePair(AbstractPlanNode scanNode) {

        SendPlanNode sendNode = new SendPlanNode(m_context, PlanAssembler.getNextPlanNodeId());
        // this will make the child planfragment be sent to all partitions
        sendNode.isMultiPartition = true;
        sendNode.addAndLinkChild(scanNode);

        ReceivePlanNode recvNode = new ReceivePlanNode(m_context, PlanAssembler.getNextPlanNodeId());
        recvNode.addAndLinkChild(sendNode);

        // receive node requires the schema of its output table
View Full Code Here

Examples of org.voltdb.plannodes.SendPlanNode

            AbstractPlanNode child = join_node.getChild(0);
            if (debug.val)
                LOG.debug(join_node + " -> " + child);
            if (child instanceof ReceivePlanNode) {
                ReceivePlanNode recv_node = (ReceivePlanNode) child;
                SendPlanNode send_node = (SendPlanNode) child.getChild(0);
                List<AbstractPlanNode> children = send_node.getChildren();
                assert (children != null);
                if (children.size() > 1)
                    continue;
                if (children.get(0).getChildPlanNodeCount() > 0)
                    continue;
                if ((children.get(0) instanceof AbstractScanPlanNode) == false)
                    continue;

                AbstractPlanNode leaf_node = children.get(0);
                assert (leaf_node instanceof AbstractScanPlanNode);
                Collection<Table> leaf_tables = CatalogUtil.getReferencedTablesForPlanNode(state.catalog_db, leaf_node);
                assert (leaf_tables.size() == 1);
                Table leaf_tbl = CollectionUtil.first(leaf_tables);

                Collection<Table> join_tables = CatalogUtil.getReferencedTablesForPlanNode(state.catalog_db, join_node);
                Table join_tbl = null;
                for (Table catalog_tbl : join_tables) {
                    if (catalog_tbl.equals(leaf_tbl) == false) {
                        join_tbl = catalog_tbl;
                        break;
                    }
                } // FOR
                assert (join_tbl != null);

                // If either table is replicated, then the leaf scan should be linked
                // directly with the Join PlanNode
                if (join_tbl.getIsreplicated() || leaf_tbl.getIsreplicated()) {
                    AbstractPlanNode parent = join_node.getParent(0);
                    assert (parent != null);
                    parent.clearChildren();
                    parent.addAndLinkChild(recv_node);
                    state.markDirty(parent);
                    state.markDirty(recv_node);

                    join_node.clearParents();
                    join_node.clearChildren();
                    leaf_node.clearParents();

                    join_node.addAndLinkChild(leaf_node);
                    state.markDirty(join_node);
                    state.markDirty(leaf_node);

                    // HACK: If the parent is a ProjectionPlanNode, then we'll want
                    // to duplicate it so that we make sure that our original
                    // SEND/RECIEVE nodes have the right offsets
                    if (parent instanceof ProjectionPlanNode) {
                        AbstractPlanNode parent_clone = null;
                        try {
                            parent_clone = (AbstractPlanNode) parent.clone(false, false);
                        } catch (CloneNotSupportedException ex) {
                            throw new RuntimeException(ex);
                        }
                        assert (parent_clone != null);
                        assert (parent != parent_clone);
                        parent_clone.addAndLinkChild(join_node);
                        send_node.clearChildren();
                        send_node.addAndLinkChild(parent_clone);
                    } else {
                        send_node.clearChildren();
                        send_node.addAndLinkChild(join_node);
                    }
                    state.markDirty(send_node);
                    modified = true;
                }
            }
View Full Code Here

Examples of org.voltdb.plannodes.SendPlanNode

            LOG.debug("ORDER BY: " + PlanNodeUtil.debug(orderby_node));
            LOG.debug(PlanNodeUtil.getPlanNodes(root, AbstractScanPlanNode.class));
        }
        AbstractScanPlanNode scan_node = CollectionUtil.first(PlanNodeUtil.getPlanNodes(root, AbstractScanPlanNode.class));
        assert (scan_node != null) : "Unexpected PlanTree:\n" + PlanNodeUtil.debug(root);
        SendPlanNode send_node = (SendPlanNode) scan_node.getParent(0);
        assert (send_node != null);

        send_node.addIntermediary(limit_node);
        if (orderby_node != null) {
            limit_node.addIntermediary(orderby_node);
            // Need to make sure that the LIMIT has the proper output columns
            limit_node.setOutputColumns(orderby_node.getOutputColumnGUIDs());
            state.markDirty(orderby_node);
View Full Code Here

Examples of org.voltdb.plannodes.SendPlanNode

//            System.out.println(PlanNodeUtil.debug(root));
//            System.out.println();
//            System.out.println();                       
//        }
       
        SendPlanNode sendNode = new SendPlanNode(m_context, getNextPlanNodeId());
        // check if there is a new root + connect the nodes to build the graph
        if (new_root != null) {
            sendNode.addAndLinkChild(new_root);
            sendNode.setOutputColumns(new_root.getOutputColumnGUIDs());           
        } else {
            sendNode.addAndLinkChild(root);
            sendNode.setOutputColumns(root.getOutputColumnGUIDs());                       
        }
       
        return sendNode;
    }
View Full Code Here

Examples of org.voltdb.plannodes.SendPlanNode

            // 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
            recvNode.updateOutputColumns(m_catalogDb);
            /*
             * recvNode.getOutputColumnNames().clear();
 
View Full Code Here

Examples of org.voltdb.plannodes.SendPlanNode

            // connect the nodes to build the graph
            updateNode.addAndLinkChild(subSelectRoot);

            // XXX: PAVLO
            if (INCLUDE_SEND_FOR_ALL) {
                SendPlanNode sendNode = new SendPlanNode(m_context, getNextPlanNodeId());
                sendNode.setFake(true);
                sendNode.addAndLinkChild(updateNode);
                sendNode.setOutputColumns(updateNode.getOutputColumnGUIDs());
                return sendNode;
            } else {
                return updateNode;
            }
           
        } 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 update 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 update node
            assert (scanNode instanceof AbstractScanPlanNode);
            scanNode.addInlinePlanNode(projectionNode);
            updateNode.addAndLinkChild(scanNode);

            AbstractPlanNode countNode = insertCountInDMLPlan(updateNode);
            sendNode.addAndLinkChild(countNode);

            // fix the receive node's output columns
            recvNode.updateOutputColumns(m_catalogDb);
            /*
             * recvNode.getOutputColumnNames().clear();
 
View Full Code Here

Examples of org.voltdb.plannodes.SendPlanNode

        if (m_singlePartition == false) {
            // all sites to a scan -> send
            // root site has many recvs feeding into a union
            rootNode = insertCountInDMLPlan(rootNode);

            SendPlanNode sendNode = new SendPlanNode(m_context, getNextPlanNodeId());
            // this will make the child planfragment be sent to all partitions
            sendNode.isMultiPartition = true;
            sendNode.addAndLinkChild(rootNode);

            ReceivePlanNode recvNode = new ReceivePlanNode(m_context, getNextPlanNodeId());
            recvNode.addAndLinkChild(sendNode);
            rootNode = recvNode;

            // receive node requires the schema of its output table
            recvNode.updateOutputColumns(m_catalogDb);

            // add a count and send on top of the union
            rootNode = addSumAndSendToDMLNode(rootNode, targetTable.getIsreplicated());
           
        } else if (INCLUDE_SEND_FOR_ALL) {
            // XXX: PAVLO
            // rootNode = addCountAndSendToDMLNode(rootNode);
            SendPlanNode sendNode = new SendPlanNode(m_context, getNextPlanNodeId());
            sendNode.setFake(true);
            sendNode.addAndLinkChild(insertNode);
            sendNode.setOutputColumns(insertNode.getOutputColumnGUIDs());
            rootNode = sendNode;
        }

        return rootNode;
    }
View Full Code Here

Examples of org.voltdb.plannodes.SendPlanNode

        // do some output column organizing...
        dmlRoot.updateOutputColumns(m_catalogDb);

        // create the nodes being pushed on top of dmlRoot.
        AggregatePlanNode countNode = new AggregatePlanNode(m_context, getNextPlanNodeId());
        SendPlanNode sendNode = new SendPlanNode(m_context, getNextPlanNodeId());

        // configure the count aggregate (sum) node to produce a single
        // output column containing the result of the sum.

        List<String> countColumnNames = new ArrayList<String>();
        List<Integer> countColumnGuids = new ArrayList<Integer>();
        List<ExpressionType> countColumnTypes = new ArrayList<ExpressionType>();
        List<Integer> countOutputColumns = countNode.getAggregateOutputColumns();

        // aggregate column name same as original dmlRoot name.
        int colGuid = dmlRoot.getOutputColumnGUIDs().get(0); // offset 0.
        countColumnNames.add(m_context.get(colGuid).getDisplayName());
        countColumnGuids.add(colGuid);
        countOutputColumns.add(0);
        // IMPORTANT: If this is for a replicated table, then we want to compute
        // the max. If it's not a replicated table, then we want to compute the SUM
        countColumnTypes.add(isReplicated ? ExpressionType.AGGREGATE_MAX : ExpressionType.AGGREGATE_SUM);
        countNode.setAggregateColumnNames(countColumnNames);
        countNode.setAggregateColumnGuids(countColumnGuids);
        countNode.setAggregateTypes(countColumnTypes);

        // The output column. Not really based on a TVE (it is really the
        // count expression represented by the count configured above). But
        // this is sufficient for now.
        TupleValueExpression tve = new TupleValueExpression();
        tve.setValueType(VoltType.BIGINT);
        tve.setValueSize(VoltType.BIGINT.getLengthInBytesForFixedTypes());
        tve.setColumnIndex(0);
        tve.setColumnName(m_context.get(colGuid).getDisplayName());
        tve.setColumnAlias(m_context.get(colGuid).getDisplayName());
        tve.setTableName("");
        PlanColumn colInfo = m_context.getPlanColumn(tve, "modified_tuples");
        countNode.appendOutputColumn(colInfo);

        // connect the nodes to build the graph
        countNode.addAndLinkChild(dmlRoot);
        sendNode.addAndLinkChild(countNode);

        return sendNode;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.