Package org.teiid.query.optimizer.relational

Examples of org.teiid.query.optimizer.relational.RuleStack


        super(arg0);
    }

   
    public void testInitialization() {
        RuleStack stack = new RuleStack();
        assertEquals("Initial stack is not empty", true, stack.isEmpty()); //$NON-NLS-1$
        assertEquals("Initial size is not 0", 0, stack.size()); //$NON-NLS-1$
        assertNull("Top is not null", stack.pop()); //$NON-NLS-1$
    }
View Full Code Here


        assertSame("Did not get same object", expectedPop, out); //$NON-NLS-1$
        assertEquals("Stack changed size", expectedSize, outSize);                     //$NON-NLS-1$
    }
   
    public void testPopOneRule() {
        RuleStack stack = new RuleStack();
        int expectedSize = stack.size();
       
        OptimizerRule rule = new RulePushSelectCriteria();
        stack.push(rule);
       
        helpTestPop(stack, rule, expectedSize);
    }
View Full Code Here

       
        helpTestPop(stack, rule, expectedSize);
    }

    public void testPopNothing() {
        RuleStack stack = new RuleStack();
        helpTestPop(stack, null, 0);
    }
View Full Code Here

        helpTestPop(stack, null, 0);
    }
   
    public void testRemove() {
        // Set up
        RuleStack stack = new RuleStack();
        stack.push(RuleConstants.ASSIGN_OUTPUT_ELEMENTS);
        stack.push(RuleConstants.COLLAPSE_SOURCE);
        stack.push(RuleConstants.ASSIGN_OUTPUT_ELEMENTS);
       
        // Remove all instances of ASSIGN_OUTPUT_ELEMENTS
        stack.remove(RuleConstants.ASSIGN_OUTPUT_ELEMENTS);
       
        // Verify size and pop'ed values
        assertEquals(1, stack.size());
        assertEquals(RuleConstants.COLLAPSE_SOURCE, stack.pop());
        assertEquals(null, stack.pop());
    }
View Full Code Here

        assertEquals(null, stack.pop());
    }
   
    public void testContains() {
        // Set up
        RuleStack stack = new RuleStack();
        stack.push(RuleConstants.ASSIGN_OUTPUT_ELEMENTS);
        stack.push(RuleConstants.COLLAPSE_SOURCE);
       
        assertEquals(true, stack.contains(RuleConstants.ASSIGN_OUTPUT_ELEMENTS));
        assertEquals(false, stack.contains(RuleConstants.PLACE_ACCESS));
    }
View Full Code Here

      //add a dummy access node
        PlanNode accessNode = NodeFactory.getNewNode(NodeConstants.Types.ACCESS);
        accessNode.addGroups(child.getFirstChild().getGroups());
      child.getFirstChild().addAsParent(accessNode);
     
      new RulePushSelectCriteria().execute(root, metadata, new DefaultCapabilitiesFinder(), new RuleStack(), AnalysisRecord.createNonRecordingRecord(), cc);
      // the select node should still be above the access node
      accessNode = NodeEditor.findNodePreOrder(root, NodeConstants.Types.ACCESS);
      assertEquals(NodeConstants.Types.SELECT, accessNode.getParent().getType());
      assertNull(NodeEditor.findNodePreOrder(accessNode, NodeConstants.Types.SELECT));
    }
View Full Code Here

    //Generate canonical plan
      RelationalPlanner p = new RelationalPlanner();
      p.initialize(query, null, METADATA, FINDER, null, new CommandContext());
      PlanNode planNode = p.generatePlan(query);
      RelationalPlanner planner = new RelationalPlanner();
    final RuleStack rules = planner.buildRules();

    PlanNode testPlan = helpExecuteRules(rules, planNode, METADATA, DEBUG);
   
    return testPlan;
  }
View Full Code Here

        capFinder.addCapabilities("pm1", TestOptimizer.getTypicalCapabilities()); //$NON-NLS-1$
        capFinder.addCapabilities("pm2", TestOptimizer.getTypicalCapabilities()); //$NON-NLS-1$
        capFinder.addCapabilities("pm3", TestOptimizer.getTypicalCapabilities()); //$NON-NLS-1$
        capFinder.addCapabilities("pm4", TestOptimizer.getTypicalCapabilities()); //$NON-NLS-1$
       
        rule.execute(bogusParentNode, metadata, capFinder, new RuleStack(), null, new CommandContext());

        if (DEBUG){
            System.out.println("Done."); //$NON-NLS-1$
            System.out.println(bogusParentNode);
        }
View Full Code Here

TOP

Related Classes of org.teiid.query.optimizer.relational.RuleStack

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.