Package org.voltdb.plannodes

Examples of org.voltdb.plannodes.AbstractPlanNode


     */
    public void testInlineProjectionColums() throws Exception {
        Procedure catalog_proc = this.getProcedure(slev.class);
        Statement catalog_stmt = this.getStatement(catalog_proc, "GetStockCount");
       
        AbstractPlanNode root = PlanNodeUtil.getRootPlanNodeForStatement(catalog_stmt, false);
        assertNotNull(root);
       
        // Make sure the bottom-most IndexScan has an inline projection with the right columns
        Collection<IndexScanPlanNode> scan_nodes = PlanNodeUtil.getPlanNodes(root, IndexScanPlanNode.class);
        assertEquals(1, scan_nodes.size());
View Full Code Here


    public void testAggregatePushdown() throws Exception {
        Procedure catalog_proc = this.getProcedure(slev.class);
        Statement catalog_stmt = this.getStatement(catalog_proc, "GetStockCount");

        // Grab the root node of the multi-partition query plan tree for this Statement
        AbstractPlanNode root = PlanNodeUtil.getRootPlanNodeForStatement(catalog_stmt, false);
        assertNotNull(root);
       
        // Check that our single scan node has a COUNT AggregatePlanNode above it.
        Collection<AbstractScanPlanNode> scan_nodes = PlanNodeUtil.getPlanNodes(root, AbstractScanPlanNode.class);
        assertEquals(1, scan_nodes.size());
        AbstractScanPlanNode scan_node = CollectionUtil.first(scan_nodes);
        assertNotNull(scan_node);
        assertEquals(1, scan_node.getParentPlanNodeCount());
        // FIXME assertEquals(PlanNodeType.AGGREGATE, scan_node.getParent(0).getPlanNodeType());
        // FIXME AggregatePlanNode count_node = (AggregatePlanNode)scan_node.getParent(0);
        // FIXME assertNotNull(count_node);
        // FIXME assert(count_node.getAggregateTypes().contains(ExpressionType.AGGREGATE_COUNT));
       
        // Now check that we have a SUM AggregatePlanNode right before the root
        // This will sum up the counts from the different partitions and give us the total count
        assertEquals(1, root.getChildPlanNodeCount());
        // FIXME assertEquals(PlanNodeType.AGGREGATE, root.getChild(0).getPlanNodeType());
        // FIXME AggregatePlanNode sum_node= (AggregatePlanNode)root.getChild(0);
        // FIXME assert(sum_node.getAggregateTypes().contains(ExpressionType.AGGREGATE_SUM));
    }
View Full Code Here

    }
   
    private void check(Statement catalog_stmt) throws Exception {
        // Grab the root node of the multi-partition query plan tree for this Statement
        for (boolean dtxn : new boolean[]{ true, false }) {
            AbstractPlanNode root = PlanNodeUtil.getRootPlanNodeForStatement(catalog_stmt, dtxn);
            assertNotNull(root);
            if (DEBUG.contains(catalog_stmt.getParent().getName()))
                System.err.println(PlanNodeUtil.debug(root));
            BasePlanOptimizerTestCase.validate(root);
        } // FOR
View Full Code Here

    @Test
    public void testExtractReferencedColumns() throws Exception {
        Procedure catalog_proc = this.getProcedure("DistinctCount");
        Statement catalog_stmt = this.getStatement(catalog_proc, "sql");
       
        AbstractPlanNode root = PlanNodeUtil.getRootPlanNodeForStatement(catalog_stmt, true);
        assertNotNull(root);
       
        Collection<SeqScanPlanNode> scan_nodes = PlanNodeUtil.getPlanNodes(root, SeqScanPlanNode.class);
        SeqScanPlanNode scan_node = CollectionUtil.first(scan_nodes);
        assertNotNull(scan_node);
View Full Code Here

        Procedure catalog_proc = this.getProcedure("AggregateCount");
        Statement catalog_stmt = this.getStatement(catalog_proc, "sql");
        this.check(catalog_stmt);

        // Grab the root node of the multi-partition query plan tree for this Statement
        AbstractPlanNode root = PlanNodeUtil.getRootPlanNodeForStatement(catalog_stmt, false);
        assertNotNull(root);
       
        // We should have two AggregatePlanNodes.
        // Make sure that they have the same GroupByColumns
        Collection<AggregatePlanNode> agg_nodes = PlanNodeUtil.getPlanNodes(root, AggregatePlanNode.class);
View Full Code Here

        Procedure catalog_proc = this.getProcedure("LimitNoWhere");
        Statement catalog_stmt = this.getStatement(catalog_proc, "sql");
        this.check(catalog_stmt);

        // Grab the root node of the multi-partition query plan tree for this Statement
        AbstractPlanNode root = PlanNodeUtil.getRootPlanNodeForStatement(catalog_stmt, false);
        //validateNodeColumnOffsets(root);
        assertNotNull(root);

        // We should have two LIMIT nodes:
        // (1) One that is inline on the SeqScan that executes at each partition
View Full Code Here

        Statement catalog_stmt = this.getStatement(catalog_proc, "sql");
        this.check(catalog_stmt);

        // Grab the root node of the multi-partition query plan tree for this
        // Statement
        AbstractPlanNode root = PlanNodeUtil.getRootPlanNodeForStatement(catalog_stmt, false);
        //validateNodeColumnOffsets(root);
        assertNotNull(root);

        // First check that our single scan node has an limit node
        Collection<LimitPlanNode> limit_nodes = PlanNodeUtil.getPlanNodes(root, LimitPlanNode.class);
View Full Code Here

        Procedure catalog_proc = this.getProcedure("LimitJoin");
        Statement catalog_stmt = this.getStatement(catalog_proc, "sql");
        this.check(catalog_stmt);

        // Grab the root node of the multi-partition query plan tree for this Statement
        AbstractPlanNode root = PlanNodeUtil.getRootPlanNodeForStatement(catalog_stmt, false);
        assertNotNull(root);

        // First check that our single scan node has an limit node
        Collection<LimitPlanNode> limit_nodes = PlanNodeUtil.getPlanNodes(root, LimitPlanNode.class);
        assertEquals(1, limit_nodes.size());
View Full Code Here

        Statement catalog_stmt = this.getStatement(catalog_proc, "sql");
        this.check(catalog_stmt);

        // Grab the root node of the multi-partition query plan tree for this
        // Statement
        AbstractPlanNode root = PlanNodeUtil.getRootPlanNodeForStatement(catalog_stmt, false);
        assertNotNull(root);
        // First check that our single scan node has an inline Projection
        Collection<AbstractScanPlanNode> scan_nodes = PlanNodeUtil.getPlanNodes(root, AbstractScanPlanNode.class);
        assertEquals(1, scan_nodes.size());
        AbstractScanPlanNode scan_node = CollectionUtil.first(scan_nodes);
View Full Code Here

     */
    @Test
    public void testClone() throws Exception {
        Procedure catalog_proc = this.getProcedure(GetNewDestination.class);
        Statement catalog_stmt = this.getStatement(catalog_proc, "GetData");
        AbstractPlanNode root = PlanNodeUtil.getRootPlanNodeForStatement(catalog_stmt, true);
        assertNotNull(root);
       
        AbstractPlanNode clone = (AbstractPlanNode)root.clone();
        assertNotNull(clone);
//        assertEquals(root, clone);
        assertFalse(root == clone);
       
        List<AbstractPlanNode> list0 = new PlanNodeList(root).getExecutionList();
        List<AbstractPlanNode> list1 = new PlanNodeList(clone).getExecutionList();
        assertEquals(list0.size(), list1.size());
       
        for (int i = 0, cnt = list0.size(); i < cnt; i++) {
            AbstractPlanNode node0 = list0.get(i);
            assertNotNull(node0);
            AbstractPlanNode node1 = list1.get(i);
            assertNotNull(node1);
           
            // Compare!
            assertFalse(node0 == node1);
            assertEquals(node0.getChildPlanNodeCount(), node1.getChildPlanNodeCount());
            assertEquals(node0.getInlinePlanNodeCount(), node1.getInlinePlanNodeCount());
            assertEquals(node0.getOutputColumnGUIDCount(), node1.getOutputColumnGUIDCount());
           
            List<AbstractExpression> exps0 = new ArrayList<AbstractExpression>(PlanNodeUtil.getExpressionsForPlanNode(node0));
            List<AbstractExpression> exps1 = new ArrayList<AbstractExpression>(PlanNodeUtil.getExpressionsForPlanNode(node1));
           
            assertEquals(exps0.size(), exps1.size());
            for (int j = 0; j < exps0.size(); j++) {
                AbstractExpression exp0 = exps0.get(j);
                assertNotNull(exp0);
                AbstractExpression exp1 = exps1.get(j);
                assertNotNull(exp1);
//                assertFalse(exp0 == exp1);
                if (exp0.equals(exp1) == false) {
                    System.err.println("Failed to clone " + node0);
                    String col0 = "";
                    for (AbstractExpression exp : exps0)
                        col0 += "\n" + ExpressionUtil.debug(exp);
                    String col1 = "";
                    for (AbstractExpression exp : exps1)
                        col1 += "\n" + ExpressionUtil.debug(exp);
                   
                    System.err.println(StringUtil.columns(col0, col1));
                }
                assertEquals(exp0, exp1);
               
            } // FOR (exps)
           
            // Make sure that they don't have the same reference!
            node0.setOutputColumns(Collections.singleton(Integer.MIN_VALUE));
            assertFalse(node0.getOutputColumnGUIDs().equals(node1.getOutputColumnGUIDs()));
        } // FOR (nodes)
    }
View Full Code Here

TOP

Related Classes of org.voltdb.plannodes.AbstractPlanNode

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.