Package org.teiid.query.processor.relational

Examples of org.teiid.query.processor.relational.RelationalPlan


        Command command = TestProcessor.helpParse(sql);
        ProcessorPlan plan = TestProcessor.helpGetPlan(command, fakeMetadata, capFinder);

        //Verify a dependent join (not merge join) was used
        assertTrue(plan instanceof RelationalPlan);
        RelationalPlan relationalPlan = (RelationalPlan)plan;
        RelationalNode project = relationalPlan.getRootNode();
        RelationalNode join = project.getChildren()[0];
        assertTrue("Expected instance of JoinNode (for dep join) but got " + join.getClass(), join instanceof JoinNode); //$NON-NLS-1$

        // Run query
        TestProcessor.helpProcess(plan, dataManager, expected);
View Full Code Here


    }
   
    public void testNoRowsFirstBatch() throws Exception {
        RelationalNode node = new FakeRelationalNode(0, new List[0]);
       
        RelationalPlan plan = new RelationalPlan(node);
        TupleBatch batch = plan.nextBatch();
        assertTrue("Did not get terminator batch", batch.getTerminationFlag()); //$NON-NLS-1$
    }  
View Full Code Here

  }
 
  @Override
  public synchronized RelationalPlan convert(PlanNode planNode)
      throws QueryPlannerException, TeiidComponentException {
      RelationalPlan result = null;
    try {
      result = super.convert(planNode);
      return result;
    } finally {
      if (result != null && update && multiSource) {
        result.setMultisourceUpdate(true);
      }
      update = false;
      multiSource = false;
    }
  }
View Full Code Here

      helpPutPreparedPlans(cache, token2, 0, 15);
     
      //read an entry for session2 (token2)
      PreparedPlan pPlan = cache.get(new CacheID(token2, pi, EXAMPLE_QUERY + 12));
      assertNotNull("Unable to get prepared plan from cache", pPlan); //$NON-NLS-1$
      assertEquals("Error getting plan from cache", new RelationalPlan(new ProjectNode(12)).toString(), pPlan.getPlan().toString()); //$NON-NLS-1$
      assertEquals("Error getting command from cache", EXAMPLE_QUERY + 12, pPlan.getCommand().toString()); //$NON-NLS-1$
      assertNotNull("Error getting plan description from cache", pPlan.getAnalysisRecord()); //$NON-NLS-1$
      assertEquals("Error gettting reference from cache", new Reference(1), pPlan.getReferences().get(0)); //$NON-NLS-1$
    }
View Full Code Here

        CacheID id = new CacheID(session, pi, dummy.toString());

        PreparedPlan pPlan = new PreparedPlan();
        cache.put(id, Determinism.SESSION_DETERMINISTIC, pPlan, null);
        pPlan.setCommand(dummy);
        pPlan.setPlan(new RelationalPlan(new ProjectNode(i)), new CommandContext());
            AnalysisRecord analysisRecord = new AnalysisRecord(true, false);
        pPlan.setAnalysisRecord(analysisRecord);
        ArrayList<Reference> refs = new ArrayList<Reference>();
        refs.add(new Reference(1));
        pPlan.setReferences(refs);
View Full Code Here

        }
       
        int cardinality = QueryMetadataInterface.UNKNOWN_CARDINALITY;
       
        if (plan instanceof RelationalPlan) {
            RelationalPlan relationalPlan = (RelationalPlan)plan;
            RelationalNode root = relationalPlan.getRootNode();
            //since the root will be a project into node, get the cost from its child
            if (root.getChildren()[0] != null) {
                root = root.getChildren()[0];
            }
            Number planCardinality = root.getEstimateNodeCardinality();
View Full Code Here

        if(debug) {
            analysisRecord.println("\nPROCESS PLAN = \n" + processNode); //$NON-NLS-1$
            analysisRecord.println("============================================================================"); //$NON-NLS-1$
        }

        RelationalPlan processPlan = new RelationalPlan(processNode);
        return processPlan;

    }
View Full Code Here

                       
                        batchNode.setElements(symbols);
                       
                        projectNode.addChild(batchNode);
                        // Add a new RelationalPlan that represents the plan for this batch.
                        childPlans.add(new RelationalPlan(projectNode));
                        if (planContexts != null) {
                          planContexts.add(new VariableContext());
                      }
                        // Skip those commands that were added to this batch
                        commandIndex += batch.size() - 1;
View Full Code Here

        RuleStack rules = buildRules();

        // Run rule-based optimizer
        plan = executeRules(rules, plan);

        RelationalPlan result = planToProcessConverter.convert(plan);
        if (withList != null && supportsWithPushdown) {
          QueryCommand queryCommand = CriteriaCapabilityValidatorVisitor.getQueryCommand(result);
          if (queryCommand != null) {
        if (CriteriaCapabilityValidatorVisitor.validateCommandPushdown(modelID, metadata, capFinder, queryCommand) == null) {
          supportsWithPushdown = false;
        } else {
          queryCommand.setWith(pushDownWith);
        }
          } else {
            supportsWithPushdown = false;
          }
        }
        if (!supportsWithPushdown) {
          result.setWith(withList);
        }
        result.setOutputElements(topCols);
       
        return result;
    }
View Full Code Here

        AnalysisRecord analysis = new AnalysisRecord(true, DEBUG);
       
        Command command = helpGetCommand(userSql, metadata, null);
        CommandContext cc = new CommandContext();
        cc.setGlobalTableStore(new TempTableStore("SYSTEM"));
        RelationalPlan plan = (RelationalPlan)TestOptimizer.getPlan(command, metadata, getGenericFinder(), analysis, true, cc);
        assertEquals(1f, plan.getRootNode().getEstimateNodeCardinality());
        TestOptimizer.checkAtomicQueries(new String[] {"SELECT #MAT_MATVIEW.VGROUP3.x, #MAT_MATVIEW.VGROUP3.y FROM #MAT_MATVIEW.VGROUP3 WHERE #MAT_MATVIEW.VGROUP3.x = 'foo'"}, plan);
        Collection<Annotation> annotations = analysis.getAnnotations();
        assertNotNull("Expected annotations but got none", annotations); //$NON-NLS-1$
        assertEquals("Expected one annotation", 1, annotations.size()); //$NON-NLS-1$
        assertEquals("Expected catagory mat view", annotations.iterator().next().getCategory(), Annotation.MATERIALIZED_VIEW); //$NON-NLS-1$
View Full Code Here

TOP

Related Classes of org.teiid.query.processor.relational.RelationalPlan

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.