Examples of AbstractPlanNode


Examples of org.voltdb.plannodes.AbstractPlanNode

        scanNode.setTargetTableAlias(table.getTypeName());
        scanNode.setTargetIndexName(index.getTypeName());
        scanNode.setEndExpression(ExpressionUtil.combine(path.endExprs));
        scanNode.setPredicate(ExpressionUtil.combine(path.otherExprs));

        AbstractPlanNode rootNode = scanNode;

        // if we need to scan everywhere...
        if (tableRequiresDistributedScan(table)) {
            // all sites to a scan -> send
            // root site has many recvs feeding into a union
View Full Code Here

Examples of org.voltdb.plannodes.AbstractPlanNode

                            if (element.getChildPlanNodeCount() != 1) {
                                LOG.warn("Invalid PlanNode Tree:\n" + PlanNodeUtil.debug(rootNode));
                            }
                            assert (element.getChildPlanNodeCount() == 1) : String.format("%s has %d children when it should have one: %s", element, element.getChildPlanNodeCount(),
                                    element.getChildren());
                            AbstractPlanNode child_node = element.getChild(0);
                            assert (child_node != null);
                            element.setOutputColumns(child_node.getOutputColumnGUIDs());
                            PlanOptimizerUtil.updateOutputOffsets(state, element);
                            if (trace.val)
                                LOG.trace("Set Output Columns for " + element + "\n" + PlanNodeUtil.debugNode(element));
                        }
                    }
View Full Code Here

Examples of org.voltdb.plannodes.AbstractPlanNode

        // build the scan node
        SeqScanPlanNode scanNode = new SeqScanPlanNode(m_context, PlanAssembler.getNextPlanNodeId());
        scanNode.setTargetTableName(table.getTypeName());
        scanNode.setPredicate(localWhere);
        AbstractPlanNode rootNode = scanNode;

        // if we need to scan everywhere...
        if (tableRequiresDistributedScan(table)) {
            // all sites to a scan -> send
            // root site has many recvs feeding into a union
View Full Code Here

Examples of org.voltdb.plannodes.AbstractPlanNode

     * @return
     */
    public static boolean updateDistinctColumns(final PlanOptimizerState state, DistinctPlanNode node) {
        // We really have one child here
        assert (node.getChildPlanNodeCount() == 1) : node;
        AbstractPlanNode child_node = node.getChild(0);
        assert (child_node != null);

        // Find the offset of our distinct column in our output. That will
        // tell us where to get the guid in the input table information
        int orig_guid = node.getDistinctColumnGuid();
        PlanColumn orig_pc = state.plannerContext.get(orig_guid);
        assert (orig_pc != null);

        node.setOutputColumns(child_node.getOutputColumnGUIDs());

        // PlanColumn new_pc = null;
        // int new_idx = 0;
        // for (Integer guid : node.getOutputColumnGUIDs()) {
        // PlanColumn pc = state.m_context.get(guid);
View Full Code Here

Examples of org.voltdb.plannodes.AbstractPlanNode

        if (debug.val)
            LOG.debug("Updating Sort Columns for " + node);

        // We really have one child here
        assert (node.getChildPlanNodeCount() == 1) : node;
        AbstractPlanNode child_node = node.getChild(0);
        assert (child_node != null);

        node.setOutputColumns(child_node.getOutputColumnGUIDs());
        // updateOutputOffsets(state, node);

        // Look at each of the SortColumns and make sure that it references a
        // PlanColumn
        // that is in our child node's output PlanColumns
View Full Code Here

Examples of org.voltdb.plannodes.AbstractPlanNode

     * @return
     */
    public static boolean updateAggregateColumns(final PlanOptimizerState state, AggregatePlanNode node) {
        // We really have one child here
        assert (node.getChildPlanNodeCount() == 1) : node;
        AbstractPlanNode child_node = node.getChild(0);
        assert (child_node != null);

        for (int i = 0, cnt = node.getAggregateColumnGuids().size(); i < cnt; i++) {
            Integer orig_guid = node.getAggregateColumnGuids().get(i);
            PlanColumn orig_pc = state.plannerContext.get(orig_guid);
            assert (orig_pc != null);

            PlanColumn new_pc = null;
            int new_idx = 0;
            for (Integer guid : child_node.getOutputColumnGUIDs()) {
                PlanColumn pc = state.plannerContext.get(guid);
                assert (pc != null);
                if (pc.equals(orig_pc, true, true)) {
                    if (trace.val)
                        LOG.trace(String.format("[%02d] Found non-expression PlanColumn match:\nORIG: %s\nNEW: %s", new_idx, orig_pc, pc));
                    new_pc = pc;
                    break;
                }
                new_idx++;
            } // FOR
            if (new_pc == null) {
                LOG.error(String.format("Failed to find %d => %s\n", new_idx, new_pc));
                LOG.error(PlanNodeUtil.debug(PlanNodeUtil.getRoot(node)));
            }
            assert (new_pc != null) :
                String.format("Failed to find %s at offset %d for %s", orig_pc, i, node);
            node.getAggregateColumnGuids().set(i, new_pc.guid());
        } // FOR

        // Need to update output column guids for GROUP BYs...
        for (int i = 0, cnt = node.getGroupByColumnGuids().size(); i < cnt; i++) {
            Integer orig_guid = node.getGroupByColumnGuids().get(i);
            PlanColumn orig_pc = state.plannerContext.get(orig_guid);
            assert (orig_pc != null);

            Pair<PlanColumn, Integer> p = findMatchingColumn(state, orig_pc, child_node.getOutputColumnGUIDs());
            if (p == null) {
                LOG.error(String.format("Failed to find %s's output %s from child node %s", node, orig_pc, child_node));
                LOG.error(PlanNodeUtil.debug(PlanNodeUtil.getRoot(node)));
            }
            assert (p != null) : String.format("Failed to find %s's output %s from child node %s", node, orig_pc, child_node);
            PlanColumn new_pc = p.getFirst();
            assert (new_pc != null);
            if (debug.val)
                LOG.debug(String.format("[%02d] Setting %s GroupByColumnGuid to %s", i, node, new_pc));
            node.getGroupByColumnGuids().set(i, new_pc.guid());
        } // FOR

        for (int i = 0, cnt = node.getOutputColumnGUIDs().size(); i < cnt; i++) {
            Integer orig_guid = node.getOutputColumnGUIDs().get(i);
            PlanColumn orig_pc = state.plannerContext.get(orig_guid);
            assert (orig_pc != null);

            // XXX: We might need to do something different if this part of our
            // aggregate output
            if (node.getAggregateOutputColumns().contains(i) == false) {
                Pair<PlanColumn, Integer> p = findMatchingColumn(state, orig_pc, child_node.getOutputColumnGUIDs());
                PlanColumn new_pc = p.getFirst();
                assert (new_pc != null);
                if (debug.val)
                    LOG.debug(String.format("[%02d] Setting %s OutputColumnGUID to %s", i, node, new_pc));
                node.getOutputColumnGUIDs().set(i, new_pc.guid());
View Full Code Here

Examples of org.voltdb.plannodes.AbstractPlanNode

     * @param node
     * @return
     */
    public static boolean updateProjectionColumns(final PlanOptimizerState state, final ProjectionPlanNode node) {
        assert (node.getChildPlanNodeCount() == 1) : node;
        final AbstractPlanNode child_node = node.getChild(0);
        assert (child_node != null);
        final List<Integer> orig_child_guids = state.orig_node_output.get(child_node);

        for (int i = 0, cnt = node.getOutputColumnGUIDCount(); i < cnt; i++) {
            // Check to make sure that the offset in the tuple value expression
            // matches
            int orig_guid = node.getOutputColumnGUID(i);
            PlanColumn orig_pc = state.plannerContext.get(orig_guid);
            assert (orig_pc != null);

            // Fix all of the offsets in the ExpressionTree
            // We have to clone it so that we don't mess up anybody else that
            // may be referencing the same PlanColumn
            AbstractExpression new_exp = null;
            try {
                new_exp = (AbstractExpression) orig_pc.getExpression().clone();
            } catch (Exception ex) {
                throw new RuntimeException("Unable to clone " + orig_pc, ex);
            }

            try {
                new ExpressionTreeWalker() {
                    @Override
                    protected void callback(AbstractExpression exp_element) {
                        if (exp_element instanceof TupleValueExpression) {
                            TupleValueExpression tv_exp = (TupleValueExpression) exp_element;
                            int orig_idx = tv_exp.getColumnIndex();
                            PlanColumn orig_child_pc = null;

                            // If this is referencing a column that we don't
                            // have a direct link to
                            // then we will see if we can match one based on its
                            // name
                            if (orig_idx >= orig_child_guids.size()) {
                                for (Integer orig_child_guid : child_node.getOutputColumnGUIDs()) {
                                    orig_child_pc = state.plannerContext.get(orig_child_guid);
                                    if (orig_child_pc.getExpression() instanceof TupleValueExpression) {
                                        TupleValueExpression orig_child_tve = (TupleValueExpression) orig_child_pc.getExpression();
                                        if (tv_exp.getTableName().equals(orig_child_tve.getTableName()) && tv_exp.getColumnAlias().equals(orig_child_tve.getColumnAlias())) {
                                            break;
                                        }
                                        orig_child_pc = null;
                                    }
                                } // FOR
                            } else {
                                orig_child_pc = state.plannerContext.get(orig_child_guids.get(orig_idx));
                            }
                            assert (orig_child_pc != null);

                            PlanColumn new_child_pc = null;
                            int new_idx = 0;
                            for (Integer orig_child_guid : child_node.getOutputColumnGUIDs()) {
                                new_child_pc = state.plannerContext.get(orig_child_guid);
                                if (orig_child_pc.equals(new_child_pc, true, true)) {
                                    break;
                                }
                                new_child_pc = null;
View Full Code Here

Examples of org.voltdb.plannodes.AbstractPlanNode

        // directly from
        // a table being scanned. Therefore, we need to first figure out the
        // original size
        // of the first input table and then use that to adjust the offsets of
        // the new tables
        AbstractPlanNode outer_node = node.getChild(0);
        assert (outer_node != null);
        final List<Integer> outer_output_guids = outer_node.getOutputColumnGUIDs();
        if (debug.val)
            LOG.debug("Calculating OUTER offsets from child node: " + outer_node);

        // Mapping from the index in the new output list to the original
        // PlanColumn guid
        final SortedMap<Integer, Integer> new_sorted_output_guids = new TreeMap<Integer, Integer>();

        // Mapping from original index to the new index
        final Map<Integer, Integer> offset_xref = new HashMap<Integer, Integer>();

        // Build a map from original offsets to the new offsets that need to be
        // stored
        // for the TupleValueExpressions (and possible TupleAddressExpression)
        final List<Integer> outer_orig_input_guids = state.orig_node_output.get(outer_node);
        assert (outer_orig_input_guids != null);
        StringBuilder sb = new StringBuilder();
        for (int orig_idx = 0, cnt = outer_orig_input_guids.size(); orig_idx < cnt; orig_idx++) {
            int orig_col_guid = outer_orig_input_guids.get(orig_idx);
            PlanColumn orig_pc = state.plannerContext.get(orig_col_guid);

            // Figure out what the new PlanColumn GUID is for this column
            // It may be the case that we need to make a new one because the
            // underlying expression has the wrong offsets
            // Find the new index of this same PlanColumn guid in the outer
            // table's output columns
            Integer new_idx = outer_output_guids.indexOf(orig_col_guid);

            // If this column is not in the outer table's output columns
            if (new_idx != -1) {
                // PlanColumn new_pc = state.plannerContext.get(orig_col_guid);
                // new_output_guids.add(orig_col_guid);
                new_sorted_output_guids.put(new_idx, orig_col_guid);
                if (debug.val)
                    LOG.debug(String.format("[%02d] Remapped PlanColumn to new offset %02d", orig_idx, new_idx));
            }
            // Check whether we even have this column. We'll compare everything
            // but the Expression
            else {
                Pair<PlanColumn, Integer> p = findMatchingColumn(state, orig_pc, outer_output_guids);

                // If we have this PlanColumn, then we need to clone it and set
                // the new column index
                // Make sure that we replace update outer_new_input_guids
                if (p != null) {
                    // PlanColumn new_pc = p.getFirst();
                    assert (p.getFirst() != null);
                    new_idx = p.getSecond();

                    TupleValueExpression clone_exp = null;
                    try {
                        clone_exp = (TupleValueExpression) orig_pc.getExpression().clone();
                    } catch (CloneNotSupportedException ex) {
                        throw new RuntimeException(ex);
                    }
                    clone_exp.setColumnIndex(new_idx);
                    PlanColumn new_col = state.plannerContext.getPlanColumn(clone_exp, orig_pc.getDisplayName(), orig_pc.getSortOrder(), orig_pc.getStorage());
                    assert (new_col != null);
                    outer_output_guids.set(new_idx, new_col.guid());
                    // new_output_guids.add(new_col.guid());
                    new_sorted_output_guids.put(new_idx, new_col.guid());
                    if (debug.val)
                        LOG.debug(String.format("OUTER OFFSET %d => %d [new_guid=%d]", orig_idx, new_idx, new_col.guid()));
                }
                // If we don't have this PlanColumn, that means that it isn't
                // being passed up from the
                // outer table and therefore don't want it anymore in our output
                else {
                    new_idx = null;
                }
            }

            if (new_idx != null) {
                assert (offset_xref.containsKey(orig_idx) == false) : orig_idx + " ==> " + offset_xref;
                offset_xref.put(orig_idx, new_idx);
            }
            // Just because we couldn't find the offset doesn't mean it's a bad
            // thing
            // It might be because we projected those columns out down below in
            // the tree
            // and therefore we don't need to worry about them anymore.
            else {
                String msg = String.format("[%02d] Failed to find new offset for OUTER %s", orig_idx, orig_pc);
                sb.append(msg).append("\n");
                if (debug.val)
                    LOG.warn(msg);
            }
        } // FOR
        if (trace.val) {
            LOG.trace("Original Outer Input GUIDs: " + outer_orig_input_guids);
            LOG.trace("New Outer Input GUIDs: " + outer_output_guids);
        }
        if (outer_output_guids.size() != offset_xref.size()) {
            LOG.error("Outer Node: " + outer_node);

            String temp = "";
            for (int i = 0; i < outer_orig_input_guids.size(); i++) {
                PlanColumn pc = state.plannerContext.get(outer_orig_input_guids.get(i));
                temp += String.format("[%02d] %s\n", i, pc);
                temp += ExpressionUtil.debug(pc.getExpression()) + "\n--------\n";
            }
            temp += "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n";
            LOG.error("Original Outer Input GUIDs: " + outer_orig_input_guids + "\n" + temp);

            temp = "";
            for (int i = 0; i < outer_output_guids.size(); i++) {
                PlanColumn pc = state.plannerContext.get(outer_output_guids.get(i));
                temp += String.format("[%02d] %s\n", i, pc);
                temp += ExpressionUtil.debug(pc.getExpression()) + "\n--------\n";
            }
            LOG.error("New Outer Input GUIDs: " + outer_output_guids + "\n" + temp);

            LOG.error("Output Xref Offsets: " + offset_xref);
            // LOG.info("Trace Information:\n" + sb);
            LOG.error("Unexpected Query Plan\n" + PlanNodeUtil.debug(PlanNodeUtil.getRoot(node)));
        }
        assert (outer_output_guids.size() == offset_xref.size()) : "outer_new_input_guids size: " + outer_output_guids.size() + " offset_xref size: " + offset_xref.size();

        // add the sorted columns into new_columns list
        final List<Integer> new_output_guids = new ArrayList<Integer>(new_sorted_output_guids.values());

        // For the inner table, we always have to offset ourselves based on the
        // size of the new outer table
        int offset = outer_output_guids.size();

        AbstractPlanNode inner_node = null;

        // These are the set of expressions for the join clause that we need to
        // fix their offsets for
        final Collection<AbstractExpression> expressions_to_fix = PlanNodeUtil.getExpressionsForPlanNode(node);

        // --------------------------------------------
        // NEST LOOP
        // --------------------------------------------
        if (node.getChildPlanNodeCount() > 1) {
            assert (node instanceof NestLoopPlanNode);
            inner_node = node.getChild(1);
            if (debug.val)
                LOG.debug("Calculating INNER offsets from child node: " + inner_node);

            List<Integer> inner_orig_input_guids = state.orig_node_output.get(inner_node);
            assert (inner_orig_input_guids != null);
            List<Integer> inner_new_input_guids = inner_node.getOutputColumnGUIDs();

            for (int orig_idx = 0, cnt = inner_orig_input_guids.size(); orig_idx < cnt; orig_idx++) {
                int col_guid = inner_orig_input_guids.get(orig_idx);

                // Find the new index of this same PlanColumn guid
                int new_idx = inner_new_input_guids.indexOf(col_guid);
                if (new_idx != -1) {
                    int offset_orig_idx = outer_orig_input_guids.size() + orig_idx;
                    int offset_new_idx = offset + new_idx;
                    if (trace.val)
                        LOG.trace(String.format("INNER NODE OFFSET %d => %d", offset_orig_idx, offset_new_idx));
                    assert (offset_xref.containsKey(offset_orig_idx) == false) : orig_idx + " ==> " + offset_xref;
                    offset_xref.put(offset_orig_idx, offset_new_idx);
                    new_output_guids.add(col_guid);
                    // sorted_new_output_guids.put(new_idx, col_guid);
                } else {
                    PlanColumn pc = state.plannerContext.get(col_guid);
                    LOG.warn("Failed to find new offset for INNER " + pc);
                }
            } // FOR
            if (trace.val)
                LOG.trace("Original Inner Input GUIDs: " + inner_orig_input_guids);
            if (trace.val)
                LOG.trace("New Inner Input GUIDs: " + inner_new_input_guids);

        // ---------------------------------------------------
        // NEST LOOP INDEX
        // ---------------------------------------------------
        } else {
            // Otherwise, just grab all of the columns for the target table in
            // the inline scan
            assert (node instanceof NestLoopIndexPlanNode);
            IndexScanPlanNode idx_node = node.getInlinePlanNode(PlanNodeType.INDEXSCAN);

            assert (idx_node != null);
            inner_node = idx_node;

            Table catalog_tbl = null;
            try {
                catalog_tbl = CollectionUtil.first(CatalogUtil.getReferencedTablesForPlanNode(state.catalog_db, idx_node));
            } catch (Exception ex) {
                LOG.fatal(ex);
                throw new RuntimeException(ex);
            }
            assert (catalog_tbl != null);
            if (debug.val)
                LOG.debug("Calculating INNER offsets from INLINE Scan: " + catalog_tbl);

            for (Column catalog_col : CatalogUtil.getSortedCatalogItems(catalog_tbl.getColumns(), "index")) {
                int i = catalog_col.getIndex();
                int offset_orig_idx = outer_orig_input_guids.size() + i;
                int offset_new_idx = offset + i;
                if (trace.val)
                    LOG.trace(String.format("INNER INLINE OFFSET %d => %d", offset_orig_idx, offset_new_idx));
                offset_xref.put(offset_orig_idx, offset_new_idx);

                // Since we're going in order, we know what column is at this
                // position.
                // That means we can grab the catalog object and convert it to a
                // PlanColumn GUID
                // Always try make a new PlanColumn and update the
                // TupleValueExpresion index
                // This ensures that we always get the ordering correct
                // int orig_guid =
                // idx_node.getOutputColumnGUID(offset_orig_idx);
                int orig_guid = CollectionUtil.first(state.column_guid_xref.get(catalog_col));
                assert (orig_guid != -1);
                PlanColumn orig_pc = state.plannerContext.get(orig_guid);
                assert (orig_pc != null);

                // PlanColumn new_pc = null;
                // int new_idx = 0;
                // for (Integer guid : idx_node.getOutputColumnGUIDs()) {
                // PlanColumn pc = state.m_context.get(guid);
                // assert (pc != null);
                // if (pc.equals(orig_pc, true, true)) {
                // if (trace.val)
                // LOG.trace(String.format("[%02d] Found inline output PlanColumn match:\nORIG: %s\nNEW: %s",
                // new_idx, orig_pc, pc));
                // new_pc = pc;
                // break;
                // }
                // new_idx++;
                // } // FOR
                // assert (new_pc != null);

                idx_node.getOutputColumnGUIDs().set(i, orig_pc.guid());
                new_output_guids.add(orig_pc.guid());
                // sorted_new_output_guids.put(i,orig_pc.guid());
                // TupleValueExpression clone_exp =
                // (TupleValueExpression)orig_col.getExpression().clone();
                // clone_exp.setColumnIndex(offset_new_idx);
                // Storage storage = (catalog_tbl.getIsreplicated() ?
                // Storage.kReplicated : Storage.kPartitioned);
                // PlanColumn new_col = state.m_context.getPlanColumn(clone_exp,
                // orig_col.displayName(), orig_col.getSortOrder(), storage);
                // assert(new_col != null);

            } // FOR

            // We also need to fix all of the search key expressions used in the
            // inline scan
            expressions_to_fix.addAll(PlanNodeUtil.getExpressionsForPlanNode(idx_node));
            // System.out.println("expressions_to_fix: " + expressions_to_fix);
        }
        if (debug.val) {
            LOG.debug("Output Xref Offsets: " + offset_xref);
            LOG.debug("New Output Columns GUIDS: " + new_sorted_output_guids);
        }

        // Get all of the AbstractExpression roots for this node
        // Now fix the offsets for everyone
        for (AbstractExpression exp : expressions_to_fix) {
            new ExpressionTreeWalker() {
                @Override
                protected void callback(AbstractExpression exp_element) {
                    if (exp_element instanceof TupleValueExpression) {
                        TupleValueExpression tv_exp = (TupleValueExpression) exp_element;
                        int orig_idx = tv_exp.getColumnIndex();

                        // If we're in a NestLoopJoin (and not a
                        // NestLoopIndexJoin), then what we need to
                        // do is take the original offset (which points to a
                        // column in the original inner input), and s

                        Integer new_idx = offset_xref.get(orig_idx);
                        if (new_idx == null) {
                            LOG.debug(PlanNodeUtil.debug(PlanNodeUtil.getRoot(node)));
                            LOG.debug(state.plannerContext.debug());
                        }
                        assert (new_idx != null) : String.format("Missing New Offset of Original Offset %02d:\n%s", orig_idx, ExpressionUtil.debug(tv_exp));
                        if (orig_idx != new_idx) {
                            if (debug.val)
                                LOG.debug(String.format("Changing offset for %s.%s [%d ==> %d]", tv_exp.getTableName(), tv_exp.getColumnName(), orig_idx, new_idx));
                            tv_exp.setColumnIndex(new_idx);
                        }

                    }
                }
            }.traverse(exp);
        }

        // Then update the output columns to reflect the change
        node.setOutputColumns(new_output_guids);
        for (int new_idx = 0, cnt = node.getOutputColumnGUIDs().size(); new_idx < cnt; new_idx++) {
            Integer col_guid = node.getOutputColumnGUIDs().get(new_idx);
            PlanColumn pc = state.plannerContext.get(col_guid);

            // Look at what our offset used versus what it is needs to be
            // If it's different, then we need to make a new PlanColumn.
            // Note that we will clone TupleValueExpression so that we do not
            // mess with
            // other PlanColumns
            // Assume that AbstractExpression is always a TupleValueExpression
            TupleValueExpression tv_exp = (TupleValueExpression) pc.getExpression();
            assert (tv_exp != null);
            int orig_idx = tv_exp.getColumnIndex();
            // assert(new_idx == offset_xref.get(orig_idx)) :
            // String.format("Offset Mismatch [orig_idx=%d] => [%d] != [%d]:\noffset_xref = %s\n%s",
            // orig_idx, new_idx, offset_xref.get(orig_idx), offset_xref,
            // PlanNodeUtil.debugNode(element));
            if (orig_idx != new_idx) {
                TupleValueExpression clone_exp = null;
                try {
                    clone_exp = (TupleValueExpression) tv_exp.clone();
                } catch (Exception ex) {
                    LOG.fatal(ex);
                    throw new RuntimeException(ex);
                }
                assert (clone_exp != null);

                // compare with child's output columns to see whether orig_idx
                // or new_idx is correct
                assert (node.getChildPlanNodeCount() == 1);
                List<Integer> child_output = node.getChild(0).getOutputColumnGUIDs();
                if (orig_idx < child_output.size() && pc.guid() == child_output.get(orig_idx)) {
                    clone_exp.setColumnIndex(orig_idx);
                } else {
                    clone_exp.setColumnIndex(new_idx);
                }
                PlanColumn new_pc = state.plannerContext.getPlanColumn(clone_exp, pc.getDisplayName(), pc.getSortOrder(), pc.getStorage());
                assert (new_pc != null);
                node.getOutputColumnGUIDs().set(new_idx, new_pc.guid());
            }
            if (trace.val)
                LOG.trace(String.format("OUTPUT[%d] => %s", new_idx, state.plannerContext.get(node.getOutputColumnGUIDs().get(new_idx))));
        } // FOR

        // IMPORTANT: If the inner_node is inline (meaning it was a
        // NestLoopIndex), then we need to also update
        // its output columns to match our new ones. This is necessary because
        // the nestloopindexexecutor will
        // generate its output table from the inline node and not the actual
        // output columns
        if (inner_node.isInline()) {
            assert (inner_node instanceof IndexScanPlanNode);
            inner_node.setOutputColumns(node.getOutputColumnGUIDs());
            if (trace.val)
                LOG.trace("Updated INNER inline " + inner_node + " output columns");
        }

        // if (debug.val) LOG.debug("PlanNodeTree:\n" +
View Full Code Here

Examples of org.voltdb.plannodes.AbstractPlanNode

            ArrayList<AccessPath> paths = getRelevantAccessPathsForTable(m_targetTable, nextTables);

            // for each access path
            for (AccessPath accessPath : paths) {
                // get a plan
                AbstractPlanNode scanPlan = getAccessPlanForTable(m_targetTable, accessPath);
                m_plans.add(scanPlan);
            }

        }
        return m_plans.poll();
View Full Code Here

Examples of org.voltdb.plannodes.AbstractPlanNode

        // the place to split is the send-recv node pairing
        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();

            // put the multipartition hint from planning in the metadata
            // for the new planfragment
            subFrag.multiPartition = sendNode.isMultiPartition;

            subFrag.planGraph = sendNode;
            currentFragment.hasDependencies = true;
            fragments.add(subFrag);

            // THIS NEXT CHUNK OF CODE IS BROKEN BY THE 2-FRAGS
            // PER PLAN ASSUMPTION
            // make sure the parent fragment depends on the child
            // sorry this is ugly append to an array code
            /*int[] parentDepList = currentFragment.dependencyIds;
            int[] newDepList = new int[parentDepList.length + 1];
            for (int i = 0; i < parentDepList.length; i++)
                newDepList[i] = parentDepList[i];
            newDepList[newDepList.length - 1] = sendNode.getDependencyId();
            currentFragment.dependencyIds = newDepList;*/

            // recursive call on the new fragment
            recursiveFindFragment(subFrag, sendNode, fragments);

            // stop here if we found a recv node
            return;
        }

        // if not a recv node, just do a boring recursive call
        // stopping condition is when there are no children
        for (int i = 0; i < currentNode.getChildPlanNodeCount(); i++) {
            AbstractPlanNode childNode = currentNode.getChild(i);
            recursiveFindFragment(currentFragment, childNode, fragments);
        }
    }
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.