Examples of OrderByPlanNode


Examples of org.voltdb.plannodes.OrderByPlanNode

            }
            // ---------------------------------------------------
            // ORDERBY
            // ---------------------------------------------------
            case ORDERBY: {
                OrderByPlanNode orby_node = (OrderByPlanNode) node;
                for (Integer col_guid : orby_node.getSortColumnGuids()) {
                    PlanColumn col = plannerContext.get(col_guid);
                    assert (col != null) : "Invalid PlanColumn #" + col_guid;
                    if (col.getExpression() != null)
                        exps.add(col.getExpression());
                } // FOR
View Full Code Here

Examples of org.voltdb.plannodes.OrderByPlanNode

            // NestLoopPlanNode
        } else if (node instanceof NestLoopPlanNode) {
            // Nothing

        } else if (node instanceof OrderByPlanNode) {
            OrderByPlanNode cast_node = (OrderByPlanNode) node;
            sb.append(inner_spacer).append(PlanNodeUtil.debugOutputColumns("SortColumns", cast_node.getSortColumnGuids(), line_spacer));

        } else if (node instanceof ProjectionPlanNode) {
            // ProjectionPlanNode cast_node = (ProjectionPlanNode)node;
            if (node instanceof MaterializePlanNode) {
                sb.append(line_spacer).append("Batched[" + ((MaterializePlanNode) node).isBatched() + "]\n");
View Full Code Here

Examples of org.voltdb.plannodes.OrderByPlanNode

            } // FOR
            // ---------------------------------------------------
            // ORDER BY
            // ---------------------------------------------------
        } else if (node instanceof OrderByPlanNode) {
            OrderByPlanNode orby_node = (OrderByPlanNode) node;
            for (Integer col_guid : orby_node.getSortColumnGuids()) {
                PlanColumn col = state.plannerContext.get(col_guid);
                assert (col != null) : "Invalid PlanColumn #" + col_guid;
                if (col.getExpression() != null)
                    exps.add(col.getExpression());
            } // FOR
View Full Code Here

Examples of org.voltdb.plannodes.OrderByPlanNode

            if (debug.val)
                LOG.debug("SKIP - Does not contain any ReceivePlanNodes");
            return (Pair.of(false, root));
        }

        OrderByPlanNode orderby_node = null;
        LimitPlanNode limit_node = null;
       
        try {
            // If there is an OrderByPlanNode, then that we need to clone that too.
            if (orderby_nodes.size() != 0) {
                orderby_node = (OrderByPlanNode) CollectionUtil.first(orderby_nodes).clone(false, true);
                assert (orderby_node != null);
            }
            limit_node = (LimitPlanNode) CollectionUtil.first(limit_nodes).clone(false, true);
        } catch (CloneNotSupportedException ex) {
            throw new RuntimeException(ex);
        }
        assert (limit_node != null);

        if (debug.val) {
            LOG.debug("LIMIT:    " + PlanNodeUtil.debug(limit_node));
            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);
        } else {
            // Need to make sure that the LIMIT has the proper output columns
            limit_node.setOutputColumns(scan_node.getOutputColumnGUIDs());
        }
View Full Code Here

Examples of org.voltdb.plannodes.OrderByPlanNode

    }

    AbstractPlanNode addOrderBy(AbstractPlanNode root) {
        assert (m_parsedSelect != null);

        OrderByPlanNode orderByNode = new OrderByPlanNode(m_context, getNextPlanNodeId());
        for (ParsedSelectStmt.ParsedColInfo col : m_parsedSelect.orderColumns) {
            orderByNode.getSortColumnNames().add(col.alias);
            orderByNode.getSortColumns().add(col.index);
            orderByNode.getSortDirections()
                    .add(
                         col.ascending ? SortDirectionType.ASC
                                      : SortDirectionType.DESC);
            PlanColumn orderByCol =
                root.findMatchingOutputColumn(col.tableName, col.columnName,
                                              col.alias);
            orderByNode.getSortColumnGuids().add(orderByCol.guid());
        }
        // connect the nodes to build the graph
        orderByNode.addAndLinkChild(root);
        orderByNode.updateOutputColumns(m_catalogDb);
        return orderByNode;
    }
View Full Code Here

Examples of org.voltdb.plannodes.OrderByPlanNode

        if (sortDirection != SortDirectionType.INVALID) {
            return root;
        }

        OrderByPlanNode orderByNode = new OrderByPlanNode();
        for (ParsedSelectStmt.ParsedColInfo col : m_parsedSelect.m_orderColumns) {
            orderByNode.addSort(col.expression,
                                col.ascending ? SortDirectionType.ASC
                                              : SortDirectionType.DESC);
        }
        orderByNode.addAndLinkChild(root);
        return orderByNode;
    }
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.