Package org.teiid.query.analysis

Examples of org.teiid.query.analysis.AnalysisRecord


    }
   
    public static ProcessorPlan getPlan(Command command, QueryMetadataInterface md, CapabilitiesFinder capFinder, AnalysisRecord analysisRecord, boolean shouldSucceed, CommandContext cc) {
    ProcessorPlan plan = null;
    if (analysisRecord == null) {
          analysisRecord = new AnalysisRecord(false, DEBUG);
    }
    Exception exception = null;
    try {
      //do planning
      plan = QueryOptimizer.optimizePlan(command, md, null, capFinder, analysisRecord, cc);
View Full Code Here


     */
    public static XMLPlan preparePlan(Command command, QueryMetadataInterface metadata, CapabilitiesFinder capFinder, CommandContext context)
        throws QueryPlannerException, QueryMetadataException, TeiidComponentException {
        IDGenerator idGenerator = new IDGenerator();
        idGenerator.setDefaultFactory(new IntegerIDFactory());
        AnalysisRecord analysis = new AnalysisRecord(false, DEBUG);
        try {
            if (DEBUG) {
                System.out.println("\n####################################\n" + command); //$NON-NLS-1$
            }
            return XMLPlanner.preparePlan(command, metadata, analysis, new XMLPlannerEnvironment(metadata), idGenerator, capFinder, context);
        } finally {
            if (DEBUG) {
                System.out.println(analysis.getDebugLog());
            }
        }
    }
View Full Code Here

        return helpTestProcess(sql, metadata, dataMgr, expectedException, new DefaultCapabilitiesFinder(), expectedDoc);
    }

    static ProcessorPlan helpTestProcess(String sql, FakeMetadataFacade metadata, FakeDataManager dataMgr, Class expectedException, CapabilitiesFinder capFinder, String... expectedDoc) throws Exception{
        Command command = helpGetCommand(sql, metadata);
        AnalysisRecord analysisRecord = new AnalysisRecord(false, DEBUG);

        try {
            CommandContext planningContext = new CommandContext(); //this should be the same as the processing context, but that's not easy to do
            planningContext.setMetadata(new TempMetadataAdapter(metadata, new TempMetadataStore()));
            ProcessorPlan plan = QueryOptimizer.optimizePlan(command, metadata, null, capFinder, analysisRecord, planningContext);
           
            if(DEBUG) {
                System.out.println(analysisRecord.getDebugLog());
            }
            List[] expected = new List[expectedDoc.length];
            for (int i = 0; i < expectedDoc.length; i++) {
        expected[i] = Arrays.asList(expectedDoc[i]);
      }
            TestProcessor.helpProcess(plan, planningContext, dataMgr, expected);
            assertNull("Expected failure", expectedException);
            return plan;
        } catch (Exception e) {
          if (expectedException == null) {
            throw e;
          }
          assertTrue(expectedException.isInstance(e));
        } finally {
            if(DEBUG) {
                System.out.println(analysisRecord.getDebugLog());
            }               
        }
        return null;
    }
View Full Code Here

            ValidatorFailure firstFailure = report.getItems().iterator().next();
            throw new QueryValidatorException(firstFailure.getMessage());
        }
        userCommand = QueryRewriter.rewrite(userCommand, metadata, null);
       
        AnalysisRecord analysisRecord = new AnalysisRecord(false, DEBUG);
       
        try {
            return QueryOptimizer.optimizePlan(userCommand, metadata, null, new DefaultCapabilitiesFinder(), analysisRecord, null);
        } finally {
            if(DEBUG) {
                System.out.println(analysisRecord.getDebugLog());
            }
        }       
  }
View Full Code Here

            ValidatorFailure firstFailure = report.getItems().iterator().next();
            throw new QueryValidatorException(firstFailure.getMessage());
        }
        QueryRewriter.rewrite(userCommand, metadata, new CommandContext());

        AnalysisRecord analysisRecord = new AnalysisRecord(false, DEBUG);
        try {
          if ( capabilitiesFinder == null ) capabilitiesFinder = new DefaultCapabilitiesFinder();
          ProcessorPlan plan = QueryOptimizer.optimizePlan(userCommand, metadata, null, capabilitiesFinder, analysisRecord, null);

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

               m.addSourceMapping("" + sourceID, "translator"null); //$NON-NLS-1$ //$NON-NLS-2$
            }
        }
       
        MultiSourceMetadataWrapper wrapper = new MultiSourceMetadataWrapper(metadata, multiSourceModels);
        AnalysisRecord analysis = new AnalysisRecord(false, DEBUG);
       
        Command command = TestResolver.helpResolve(userSql, wrapper);              
               
        // Plan
        command = QueryRewriter.rewrite(command, wrapper, null);
View Full Code Here

        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

  }
   
    //TODO: display the analysis record info
    public void compileXqueryExpression() throws QueryResolverException {
      this.xqueryExpression = new SaxonXQueryExpression(xquery, namespaces, passing, null);
      this.xqueryExpression.useDocumentProjection(null, new AnalysisRecord(false, false));
    }
View Full Code Here

 
    @Test public void testMaterializedTransformation() throws Exception {
        String userSql = "SELECT MATVIEW.E1 FROM MATVIEW"; //$NON-NLS-1$
       
        QueryMetadataInterface metadata = RealMetadataFactory.exampleMaterializedView();
        AnalysisRecord analysis = new AnalysisRecord(true, DEBUG);
       
        Command command = helpGetCommand(userSql, metadata, null);
       
        TestOptimizer.helpPlanCommand(command, metadata, getGenericFinder(), analysis, new String[] {"SELECT g_0.e1 FROM MatTable.MatTable AS g_0"}, ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$

        Collection<Annotation> annotations = analysis.getAnnotations();
        assertNotNull("Expected annotations but got none", annotations); //$NON-NLS-1$
        assertTrue("Expected one annotation", annotations.size() == 1); //$NON-NLS-1$
        assertEquals("Expected catagory mat view", annotations.iterator().next().getCategory(), Annotation.MATERIALIZED_VIEW); //$NON-NLS-1$
    }
View Full Code Here

    @Ignore("we no longer auto detect this case, if we need this logic it will have to be added to the rewriter since it changes select into to an insert")
    @Test public void testMaterializedTransformationLoading() throws Exception {
        String userSql = "SELECT MATVIEW.E1 INTO MatTable.MatStage FROM MATVIEW"; //$NON-NLS-1$
       
        QueryMetadataInterface metadata = RealMetadataFactory.exampleMaterializedView();
        AnalysisRecord analysis = new AnalysisRecord(true, DEBUG);

        Command command = helpGetCommand(userSql, metadata, null);
       
        TestOptimizer.helpPlanCommand(command, metadata, getGenericFinder(), analysis, new String[] {"SELECT g_0.x FROM MatSrc.MatSrc AS g_0"}, ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$

        Collection<Annotation> annotations = analysis.getAnnotations();
        assertNotNull("Expected annotations but got none", annotations); //$NON-NLS-1$
        assertTrue("Expected one annotation", annotations.size() == 1); //$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.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.