Package org.teiid.query.metadata

Examples of org.teiid.query.metadata.TempMetadataAdapter


    }
   
    public static void helpTestProcess(ProcessorPlan procPlan, List[] expectedResults, ProcessorDataManager dataMgr, QueryMetadataInterface metadata) throws Exception {
        CommandContext context = new CommandContext("pID", null, null, null, 1); //$NON-NLS-1$
        if (!(metadata instanceof TempMetadataAdapter)) {
          metadata = new TempMetadataAdapter(metadata, new TempMetadataStore());
        }
        context.setMetadata(metadata);         
       
      TestProcessor.helpProcess(procPlan, context, dataMgr, expectedResults);
      assertNotNull("Expected processing to fail", expectedResults);
View Full Code Here


    assertTrue(Determinism.SESSION_DETERMINISTIC.compareTo(cc.getDeterminismLevel()) <= 0);
  }

  @Before public void setUp() {
    tempStore = new TempTableStore("1"); //$NON-NLS-1$
    metadata = new TempMetadataAdapter(FakeMetadataFactory.example1Cached(), tempStore.getMetadataStore());
    metadata.setSession(true);
    FakeDataManager fdm = new FakeDataManager();
      TestProcessor.sampleData1(fdm);
      BufferManager bm = BufferManagerFactory.getStandaloneBufferManager();
      SessionAwareCache<CachedResults> cache = new SessionAwareCache<CachedResults>();
View Full Code Here

  private HardcodedDataManager hdm;
 
  @Before public void setUp() {
    tempStore = new TempTableStore("1"); //$NON-NLS-1$
    globalStore  = new TempTableStore("SYSTEM");
    metadata = new TempMetadataAdapter(RealMetadataFactory.exampleMaterializedView(), tempStore.getMetadataStore());
    hdm = new HardcodedDataManager();
    hdm.addData("SELECT matsrc.x FROM matsrc", new List[] {Arrays.asList((String)null), Arrays.asList("one"), Arrays.asList("two"), Arrays.asList("three")});
    hdm.addData("SELECT mattable.info.e1, mattable.info.e2 FROM mattable.info", new List[] {Arrays.asList("a", 1), Arrays.asList("a", 2)});
    hdm.addData("SELECT mattable.info.e2, mattable.info.e1 FROM mattable.info", new List[] {Arrays.asList(1, "a"), Arrays.asList(2, "a")});
   
View Full Code Here

    }
     
    static ProcessorPlan optimizePlan(Command query, XMLPlannerEnvironment planEnv)
        throws QueryPlannerException, QueryMetadataException, TeiidComponentException {

        TempMetadataAdapter metadata = planEnv.getGlobalMetadata();
        ProcessorPlan plan = QueryOptimizer.optimizePlan(query, metadata, planEnv.idGenerator, planEnv.capFinder, planEnv.analysisRecord, planEnv.context);
   
        return plan;
    }
View Full Code Here

        return processorEnv;
    }
     
       
    TempMetadataAdapter getGlobalMetadata() {
        return new TempMetadataAdapter(metadata, new TempMetadataStore(this.globalTempMetadata), this.stagingTableMap, this.queryNodeMap);
    }
View Full Code Here

  public static void findChildCommandMetadata(Command currentCommand,
      GroupSymbol container, int type, QueryMetadataInterface metadata)
      throws QueryMetadataException, TeiidComponentException {
    //find the childMetadata using a clean metadata store
      TempMetadataStore childMetadata = new TempMetadataStore();
      TempMetadataAdapter tma = new TempMetadataAdapter(metadata, childMetadata);
      GroupContext externalGroups = new GroupContext();

    if (currentCommand instanceof TriggerAction) {
      TriggerAction ta = (TriggerAction)currentCommand;
      ta.setView(container);
        //TODO: it seems easier to just inline the handling here rather than have each of the resolvers check for trigger actions
        List<ElementSymbol> viewElements = ResolverUtil.resolveElementsInGroup(ta.getView(), metadata);
        if (type == Command.TYPE_UPDATE || type == Command.TYPE_INSERT) {
          ProcedureContainerResolver.addChanging(tma.getMetadataStore(), externalGroups, viewElements);
          ProcedureContainerResolver.addScalarGroup(SQLConstants.Reserved.NEW, tma.getMetadataStore(), externalGroups, viewElements, false);
        }
        if (type == Command.TYPE_UPDATE || type == Command.TYPE_DELETE) {
          ProcedureContainerResolver.addScalarGroup(SQLConstants.Reserved.OLD, tma.getMetadataStore(), externalGroups, viewElements, false);
        }
    } else if (currentCommand instanceof CreateUpdateProcedureCommand) {
      CreateUpdateProcedureCommand cupc = (CreateUpdateProcedureCommand)currentCommand;
      cupc.setVirtualGroup(container);
View Full Code Here

        Set<ElementSymbol> expected = new HashSet<ElementSymbol>(Arrays.asList(new ElementSymbol("e2"))); //$NON-NLS-1$
        assertEquals(expected, RulePushSelectCriteria.getElementsIncriteria(QueryParser.getQueryParser().parseCriteria(criteria)));
    }
   
    @Test public void testPushAcrossFrameWithAccessNode() throws Exception {
      QueryMetadataInterface metadata = new TempMetadataAdapter(FakeMetadataFactory.example1Cached(), new TempMetadataStore());
      Command command = TestOptimizer.helpGetCommand("select * from (select * from pm1.g1 union select * from pm1.g2) x where e1 = 1", metadata, null); //$NON-NLS-1$
      Command subCommand = TestOptimizer.helpGetCommand("select * from pm1.g1 union select * from pm1.g2", metadata, null); //$NON-NLS-1$
      RelationalPlanner p = new RelationalPlanner();
      CommandContext cc = new CommandContext();
      p.initialize(command, null, metadata, null, null, cc);
View Full Code Here

    }
   
        boolean debug = analysisRecord.recordDebug();
       
        Map tempMetadata = command.getTemporaryMetadata();
        metadata = new TempMetadataAdapter(metadata, new TempMetadataStore(tempMetadata));
               
        // Create an ID generator that can be used for all plans to generate unique data node IDs
        if(idGenerator == null) {
            idGenerator = new IDGenerator();
            idGenerator.setDefaultFactory(new IntegerIDFactory());
View Full Code Here

    public static TempMetadataStore resolveCommand(Command currentCommand, QueryMetadataInterface metadata, boolean resolveNullLiterals)
        throws QueryResolverException, TeiidComponentException {

    LogManager.logTrace(org.teiid.logging.LogConstants.CTX_QUERY_RESOLVER, new Object[]{"Resolving command", currentCommand}); //$NON-NLS-1$
       
        TempMetadataAdapter resolverMetadata = null;
        try {
            Map tempMetadata = currentCommand.getTemporaryMetadata();
            if(tempMetadata == null) {
                currentCommand.setTemporaryMetadata(new HashMap());
            }
           
            TempMetadataStore discoveredMetadata = new TempMetadataStore(currentCommand.getTemporaryMetadata());
           
            resolverMetadata = new TempMetadataAdapter(metadata, discoveredMetadata);
           
            // Resolve external groups for command
            Collection<GroupSymbol> externalGroups = currentCommand.getAllExternalGroups();
            for (GroupSymbol extGroup : externalGroups) {
                Object metadataID = extGroup.getMetadataID();
                //make sure that the group is resolved and that it is pointing to the appropriate temp group
                //TODO: this is mainly for XML resolving since it sends external groups in unresolved
                if (metadataID == null || (!(extGroup.getMetadataID() instanceof TempMetadataID) && discoveredMetadata.getTempGroupID(extGroup.getName()) != null)) {
                    metadataID = resolverMetadata.getGroupID(extGroup.getName());
                    extGroup.setMetadataID(metadataID);
                }
            }

            CommandResolver resolver = chooseResolver(currentCommand, resolverMetadata);

            // Resolve this command
            resolver.resolveCommand(currentCommand, resolverMetadata, resolveNullLiterals);           
        } catch(QueryMetadataException e) {
            throw new QueryResolverException(e, e.getMessage());
        }

        // Flag that this command has been resolved.
        currentCommand.setIsResolved(true);
       
        return resolverMetadata.getMetadataStore();
    }
View Full Code Here

    QueryMetadataInterface oldMetadata = metadata;
    CreateUpdateProcedureCommand oldProcCommand = procCommand;
       
    Map tempMetadata = command.getTemporaryMetadata();
        if(tempMetadata != null) {
          metadata = new TempMetadataAdapter(metadata, new TempMetadataStore(tempMetadata));
        }
       
        switch(command.getType()) {
      case Command.TYPE_QUERY:
                QueryCommand queryCommand = (QueryCommand)command;
View Full Code Here

TOP

Related Classes of org.teiid.query.metadata.TempMetadataAdapter

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.