Examples of UpdatePlanNode


Examples of org.voltdb.plannodes.UpdatePlanNode

            case UPDATE: {
                // Need to make sure we get both the WHERE clause and the fields
                // that are updated
                // We need to get the list of columns from the ScanPlanNode
                // below us
                UpdatePlanNode up_node = (UpdatePlanNode) node;
                Table catalog_tbl = catalog_db.getTables().get(up_node.getTargetTableName());
                assert (catalog_tbl != null) : "Missing table " + up_node.getTargetTableName();

                AbstractScanPlanNode scan_node = CollectionUtil.first(PlanNodeUtil.getPlanNodes(up_node, AbstractScanPlanNode.class));
                assert (scan_node != null) : "Failed to find underlying scan node for " + up_node;

                updateReferenceColumns(PlanNodeUtil.getUpdatedColumnsForPlanNode(catalog_db, scan_node), false, allCols, modifiedCols, readOnlyCols);
View Full Code Here

Examples of org.voltdb.plannodes.UpdatePlanNode

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

        UpdatePlanNode updateNode = new UpdatePlanNode(m_context, getNextPlanNodeId());
        updateNode.setTargetTableName(targetTable.getTypeName());
        // set this to false until proven otherwise
        updateNode.setUpdateIndexes(false);

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

        // get the set of columns affected by indexes
        Set<String> affectedColumns = getIndexedColumnSetForTable(targetTable);

        // add the output columns we need
        for (Entry<Column, AbstractExpression> col : m_parsedUpdate.columns.entrySet()) {
            colInfo = m_context.getPlanColumn(col.getValue(), col.getKey().getTypeName());
            projectionNode.appendOutputColumn(colInfo);

            // check if this column is an indexed column
            if (affectedColumns.contains(colInfo.getDisplayName()))
                updateNode.setUpdateIndexes(true);
        }

        if (m_singlePartition == true) {

            // add the projection inline (TODO: this will break if more than one
            // layer is below this)
            assert(subSelectRoot instanceof AbstractScanPlanNode);
            subSelectRoot.addInlinePlanNode(projectionNode);

            // 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
View Full Code Here

Examples of org.voltdb.plannodes.UpdatePlanNode

            // Recursion here, now that subAssembler.nextPlan() has been called,
            // simply jumps ahead to the next plan (if any).
            return getNextUpdatePlan();
        }

        UpdatePlanNode updateNode = new UpdatePlanNode();
        Table targetTable = m_parsedUpdate.m_tableList.get(0);
        updateNode.setTargetTableName(targetTable.getTypeName());
        // set this to false until proven otherwise
        updateNode.setUpdateIndexes(false);

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

        // get the set of columns affected by indexes
        Set<String> affectedColumns = getIndexedColumnSetForTable(targetTable);

        // add the output columns we need to the projection
        //
        // Right now, the EE is going to use the original column names
        // and compare these to the persistent table column names in the
        // update executor in order to figure out which table columns get
        // updated.  We'll associate the actual values with VOLT_TEMP_TABLE
        // to avoid any false schema/column matches with the actual table.
        for (Entry<Column, AbstractExpression> col : m_parsedUpdate.columns.entrySet()) {
            String tableName = col.getKey().getTypeName();
            AbstractExpression expr = col.getValue();
            expr.setInBytes(col.getKey().getInbytes());

            proj_schema.addColumn(new SchemaColumn("VOLT_TEMP_TABLE",
                                                   "VOLT_TEMP_TABLE",
                                                   tableName,
                                                   tableName,
                                                   expr));

            // check if this column is an indexed column
            if (affectedColumns.contains(col.getKey().getTypeName()))
            {
                updateNode.setUpdateIndexes(true);
            }
        }
        projectionNode.setOutputSchema(proj_schema);


        // add the projection inline (TODO: this will break if more than one
        // layer is below this)
        //
        // When we inline this projection into the scan, we're going
        // to overwrite any original projection that we might have inlined
        // in order to simply cull the columns from the persistent table.
        assert(subSelectRoot instanceof AbstractScanPlanNode);
        subSelectRoot.addInlinePlanNode(projectionNode);

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

        if (m_partitioning.wasSpecifiedAsSingle() || m_partitioning.isInferredSingle()) {
            return updateNode;
        }
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.