Examples of TempMetadataStore


Examples of org.teiid.query.metadata.TempMetadataStore

    }
   
    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

Examples of org.teiid.query.metadata.TempMetadataStore

    addTable("pm2.g2", dataMgr, metadata);
    addTable("pm2.g3", dataMgr, metadata);
    addTable("tm1.g1", dataMgr, metadata);

        //stored procedure pm1.sp1
        TempMetadataStore tempStore = new TempMetadataStore();         
        StoredProcedureInfo procInfo = metadata.getStoredProcedureInfoForProcedure("pm1.sp1"); //$NON-NLS-1$
        List elementSymbols = getProcResultSetSymbols(procInfo.getParameters());
        tempStore.addTempGroup("pm1.sp1", elementSymbols); //$NON-NLS-1$
        Object procID = tempStore.getTempGroupID("pm1.sp1"); //$NON-NLS-1$
        dataMgr.registerTuples(
            procID,
            elementSymbols,
           
            new List[] {
View Full Code Here

Examples of org.teiid.query.metadata.TempMetadataStore

        }
       
        if (tempTable) {
            resolveNullLiterals(symbols);
        }
        TempMetadataStore store = metadata.getMetadataStore();
        return store.addTempGroup(symbol.getName(), symbols, !tempTable, tempTable);
    }
View Full Code Here

Examples of org.teiid.query.metadata.TempMetadataStore

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

Examples of org.teiid.query.metadata.TempMetadataStore

   */
  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);

      if (type == Command.TYPE_STORED_PROCEDURE) {
        StoredProcedureInfo info = metadata.getStoredProcedureInfoForProcedure(container.getCanonicalName());
            // Create temporary metadata that defines a group based on either the stored proc
            // name or the stored query name - this will be used later during planning
            String procName = info.getProcedureCallableName();
           
            // Look through parameters to find input elements - these become child metadata
            List<ElementSymbol> tempElements = new ArrayList<ElementSymbol>(info.getParameters().size());
            boolean[] updatable = new boolean[info.getParameters().size()];
            int i = 0;
            for (SPParameter param : info.getParameters()) {
                if(param.getParameterType() != ParameterInfo.RESULT_SET) {
                    ElementSymbol symbol = param.getParameterSymbol();
                    tempElements.add(symbol);
                    updatable[i++] = param.getParameterType() != ParameterInfo.IN; 
                }
            }

            ProcedureContainerResolver.addScalarGroup(procName, childMetadata, externalGroups, tempElements, updatable);
      } else if (type != Command.TYPE_DELETE) {
        createInputChangingMetadata(childMetadata, tma, container, externalGroups);
      }
    }
   
      QueryResolver.setChildMetadata(currentCommand, childMetadata.getData(), externalGroups);
  }
View Full Code Here

Examples of org.teiid.query.metadata.TempMetadataStore

        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

Examples of org.teiid.query.metadata.TempMetadataStore

    }
   
        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

Examples of org.teiid.query.metadata.TempMetadataStore

              return elements.get(ref.getIndex()).clone();
            }
          };
          DeepPostOrderNavigator.doVisit(currentCommand, emv);
        } else {
            TempMetadataStore rootExternalStore = new TempMetadataStore();
           
            GroupContext externalGroups = new GroupContext();
           
            ProcedureContainerResolver.addScalarGroup(ProcedureReservedWords.INPUT, rootExternalStore, externalGroups, elements);
            ProcedureContainerResolver.addScalarGroup(ProcedureReservedWords.INPUTS, rootExternalStore, externalGroups, elements);
            QueryResolver.setChildMetadata(currentCommand, rootExternalStore.getData(), externalGroups);
        }
    }
    TempMetadataStore result = resolveCommand(currentCommand, metadata, false);
    if (replaceBindings && symbolMap != null && !symbolMap.isEmpty()) {
      ExpressionMappingVisitor emv = new ExpressionMappingVisitor(symbolMap);
      DeepPostOrderNavigator.doVisit(currentCommand, emv);
    }
    return result;
View Full Code Here

Examples of org.teiid.query.metadata.TempMetadataStore

            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);
                }
            }
View Full Code Here

Examples of org.teiid.query.metadata.TempMetadataStore

    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
Copyright © 2018 www.massapi.com. 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.