Package org.teiid.query.analysis

Examples of org.teiid.query.analysis.AnalysisRecord


       
    @Test public void testProcParamComparison_defect13653() {
        String userSql = "SELECT * FROM (EXEC mmspTest1.MMSP5('a')) AS a, (EXEC mmsptest1.mmsp6('b')) AS b"; //$NON-NLS-1$
       
        QueryMetadataInterface metadata = FakeMetadataFactory.exampleBQTCached();
        AnalysisRecord analysis = AnalysisRecord.createNonRecordingRecord();
       
        Query query = (Query) helpResolve(userSql, metadata);
        From from = query.getFrom();
        Collection fromClauses = from.getClauses();
        SPParameter params[] = new SPParameter[2];
View Full Code Here


    }
    }
 
    static ProcessorPlan helpGetPlan(Command command, QueryMetadataInterface metadata, CapabilitiesFinder capFinder, CommandContext context) throws TeiidException {
    if(DEBUG) System.out.println("\n####################################\n" + command); //$NON-NLS-1$
    AnalysisRecord analysisRecord = new AnalysisRecord(false, DEBUG);
    if (!(metadata instanceof TempMetadataAdapter)) {
      metadata = new TempMetadataAdapter(metadata, new TempMetadataStore());
    }
    context.setMetadata(metadata);
        try {
      QueryResolver.resolveCommand(command, metadata);
       
      ValidatorReport repo  = Validator.validate(command, metadata);
          Collection failures = new ArrayList();
          repo.collectInvalidObjects(failures);
          if (failures.size() > 0){
              fail("Exception during validation (" + repo); //$NON-NLS-1$
          }       
      command = QueryRewriter.rewrite(command, metadata, context);
          ProcessorPlan process = QueryOptimizer.optimizePlan(command, metadata, null, capFinder, analysisRecord, context);
      if(DEBUG) System.out.println("\n" + process); //$NON-NLS-1$
          //per defect 10022, clone this plan before processing, just to make sure
          //a cloned plan with correlated subquery references (or any cloned plan) can be processed
          process = process.clone();
         
          assertNotNull("Output elements of process plan are null", process.getOutputElements()); //$NON-NLS-1$

      return process;
    } finally {
            if(DEBUG) {
                System.out.println(analysisRecord.getDebugLog());
            }
        }
  }
View Full Code Here

      CommandContext context = createCommandContext();
      context.setMetadata(metadata);
        Command command = TestOptimizer.helpGetCommand(sql, metadata, null);

        // plan
        AnalysisRecord analysisRecord = new AnalysisRecord(false, debug);
        ProcessorPlan plan = null;
        try {
            plan = QueryOptimizer.optimizePlan(command, metadata, null, capFinder, analysisRecord, createCommandContext());
        } finally {
            if(debug) {
                System.out.println(analysisRecord.getDebugLog());
            }
        }

      TestProcessor.doProcess(plan, dataManager, expectedResults, context);
    }
View Full Code Here

        List<Reference> references = ReferenceCollectorVisitor.getReferences(command);
       
        checkReferences(references);
       
        this.analysisRecord = new AnalysisRecord(requestMsg.getShowPlan() != ShowPlan.OFF, requestMsg.getShowPlan() == ShowPlan.DEBUG);
               
        resolveCommand(command);
       
        validateAccess(userCommand);
       
View Full Code Here

   
    private BatchedUpdatePlan helpPlanCommand(Command command, QueryMetadataInterface md, CapabilitiesFinder capFinder, boolean shouldSucceed) throws QueryPlannerException, QueryMetadataException, TeiidComponentException {
       
        // plan
        ProcessorPlan plan = null;
        AnalysisRecord analysisRecord = new AnalysisRecord(false, DEBUG);
        if (shouldSucceed) {
            try {
                //do planning
                plan = QueryOptimizer.optimizePlan(command, md, null, capFinder, analysisRecord, null);

            } finally {
                if(DEBUG) {
                    System.out.println(analysisRecord.getDebugLog());
                }
            }
            return (BatchedUpdatePlan)plan;
        }
        Exception exception = null;
        try {
            //do planning
            QueryOptimizer.optimizePlan(command, md, null, capFinder, analysisRecord, null);

        } catch (QueryPlannerException e) {
            exception = e;
        } catch (TeiidComponentException e) {
            exception = e;
        } finally {
            if(DEBUG) {
                System.out.println(analysisRecord.getDebugLog());
            }
        }
        assertNotNull("Expected exception but did not get one.", exception); //$NON-NLS-1$
        return null;
    }
View Full Code Here

         
          AbstractValidationVisitor visitor = new ValidationVisitor();
          Request.validateWithVisitor(visitor, metadata, newCommand);
          Determinism determinismLevel = copy.resetDeterminismLevel();
          newCommand = QueryRewriter.rewrite(newCommand, metadata, copy);
          AnalysisRecord record = new AnalysisRecord(false, false);
          ProcessorPlan plan = QueryOptimizer.optimizePlan(newCommand, metadata, idGenerator, finder, record, copy);
          pp = new PreparedPlan();
          pp.setPlan(plan, copy);
          pp.setReferences(references);
          pp.setAnalysisRecord(record);
View Full Code Here

    public TestAnalysisRecord(String name) {
        super(name);
    }

    public void testAnnotations() {
        AnalysisRecord rec = new AnalysisRecord(true, false);
        assertTrue(rec.recordAnnotations());
       
        Annotation ann1 = new Annotation("cat", "ann", "res", Priority.MEDIUM); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
        Annotation ann2 = new Annotation("cat2", "ann2", "res2", Priority.HIGH); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
     
        rec.addAnnotation(ann1);
        rec.addAnnotation(ann2);
       
        Collection<Annotation> annotations = rec.getAnnotations();
        assertEquals(2, annotations.size());
        assertTrue(annotations.contains(ann1));
        assertTrue(annotations.contains(ann2));
       
    }
View Full Code Here

        assertTrue(annotations.contains(ann2));
       
    }
   
    public void testDebugLog() {
        AnalysisRecord rec = new AnalysisRecord(false, true);
        assertTrue(rec.recordDebug());
       
        rec.println("a"); //$NON-NLS-1$
        rec.println("b"); //$NON-NLS-1$
       
        String log = rec.getDebugLog();
        assertEquals("a" + StringUtil.LINE_SEPARATOR + "b" + StringUtil.LINE_SEPARATOR, log); //$NON-NLS-1$ //$NON-NLS-2$
    }
View Full Code Here

TOP

Related Classes of org.teiid.query.analysis.AnalysisRecord

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.