Package org.teiid.query.metadata

Examples of org.teiid.query.metadata.TempMetadataID


      String name = symbol.getShortName();
            String virtualElementName = virtualGroup.getCanonicalName() + ElementSymbol.SEPARATOR + name;
            ElementSymbol virtualElement = new ElementSymbol(virtualElementName);
            virtualElement.setGroupSymbol(virtualGroup);
            virtualElement.setType(symbol.getType());
            virtualElement.setMetadataID(new TempMetadataID(virtualElementName, symbol.getType()));
            updatedVirturalElement.add(virtualElement);
    }
    SymbolMap newParentMap = SymbolMap.createSymbolMap(updatedVirturalElement, projectedViewSymbols);
    child.setProperty(NodeConstants.Info.SYMBOL_MAP, newParentMap);
    Map<AggregateSymbol, ElementSymbol> projectedMap = new HashMap<AggregateSymbol, ElementSymbol>();
View Full Code Here


        QueryParser parser = QueryParser.getQueryParser();
        Command userCommand = userQuery != null ? parser.parseCommand(userQuery) : parser.parseCommand(procedure);
       
        if (userCommand instanceof CreateUpdateProcedureCommand) {
          GroupSymbol gs = new GroupSymbol("proc");
          gs.setMetadataID(new TempMetadataID("proc", Collections.EMPTY_LIST));
          ((CreateUpdateProcedureCommand)userCommand).setVirtualGroup(gs);
        }
       
        QueryResolver.resolveCommand(userCommand, metadata);
    ValidatorReport report = Validator.validate(userCommand, metadata);
View Full Code Here

        ResultSetInfo rsInfo = planEnv.getStagingTableResultsInfo(stageGroupName);
        rsInfo.setCommand(cmd);
        rsInfo.setPlan(plan);
       
        //set the carinality on the temp group.
        TempMetadataID intoGroupID = (TempMetadataID)intoGroupSymbol.getMetadataID();
        intoGroupID.setCardinality(cardinality);
       
        // add the meterialization hook for the staged table to original one.
        //GroupSymbol groupSymbol = (GroupSymbol)query.getFrom().getGroups().get(0);
        planEnv.addStagingTable(srcGroup.getMetadataID(), intoGroupID);
       
View Full Code Here

                  }
                  matchedSymbol = knownElements.get(j);
                  position = j;
            }
            if (matchedSymbol != null) {
                TempMetadataID tempMetadataID = new TempMetadataID(symbol.getName(), matchedSymbol.getType());
                symbol.setMetadataID(tempMetadataID);
                symbol.setType(matchedSymbol.getType());
            }
                    if (position != -1) {
                        orderBy.setExpressionPosition(i, position);
View Full Code Here

       
        //if there is no into group, just create temp metadata ids
        if (dynamicCmd.getIntoGroup() == null) {
            while (columns.hasNext()) {
                ElementSymbol column = (ElementSymbol)columns.next();
                column.setMetadataID(new TempMetadataID(column.getShortCanonicalName(), column.getType()));
            }
        } else if (dynamicCmd.getIntoGroup().isTempGroupSymbol()) {
            while (columns.hasNext()) {
                ElementSymbol column = (ElementSymbol)columns.next();
                column.setGroupSymbol(new GroupSymbol(dynamicCmd.getIntoGroup().getCanonicalName()));
            }
        }
       
        ResolverVisitor.resolveLanguageObject(dynamicCmd, groups, dynamicCmd.getExternalGroupContexts(), metadata);
       
        String sqlType = DataTypeManager.getDataTypeName(dynamicCmd.getSql().getType());
        String targetType = DataTypeManager.DefaultDataTypes.STRING;
       
        if (!targetType.equals(sqlType) && !DataTypeManager.isImplicitConversion(sqlType, targetType)) {
            throw new QueryResolverException(QueryPlugin.Util.getString("DynamicCommandResolver.SQL_String", sqlType)); //$NON-NLS-1$
        }
       
        if (dynamicCmd.getUsing() != null && !dynamicCmd.getUsing().isEmpty()) {
            for (SetClause clause : dynamicCmd.getUsing().getClauses()) {
                ElementSymbol id = clause.getSymbol();
                id.setGroupSymbol(new GroupSymbol(ProcedureReservedWords.DVARS));
                id.setType(clause.getValue().getType());
                id.setMetadataID(new TempMetadataID(id.getCanonicalName(), id.getType()));
            }
        }
       
        GroupSymbol intoSymbol = dynamicCmd.getIntoGroup();
        if (intoSymbol != null) {
View Full Code Here

        discoveredMetadata.addTempGroup(procName, tempElements, isVirtual);

        // Resolve tempElements against new metadata
        GroupSymbol procGroup = new GroupSymbol(storedProcedureInfo.getProcedureCallableName());
        procGroup.setProcedure(true);
        TempMetadataID tid = discoveredMetadata.getTempGroupID(procName);
        tid.setOriginalMetadataID(storedProcedureCommand.getProcedureID());
        procGroup.setMetadataID(tid);
        storedProcedureCommand.setGroup(procGroup);
    }
View Full Code Here

  }
 
  public static GroupSymbol addScalarGroup(String name, TempMetadataStore metadata, GroupContext externalGroups, List<? extends SingleElementSymbol> symbols, boolean[] updatable) {
    GroupSymbol variables = new GroupSymbol(name);
      externalGroups.addGroup(variables);
      TempMetadataID tid = metadata.addTempGroup(name, symbols);
      tid.setMetadataType(Type.SCALAR);
      int i = 0;
      for (TempMetadataID cid : tid.getElements()) {
      cid.setMetadataType(Type.SCALAR);
      cid.setUpdatable(updatable[i++]);
    }
      variables.setMetadataID(tid);
      return variables;
View Full Code Here

      return groupToTupleSourceID.containsKey(tempTableName);
    }

    TempTable addTempTable(String tempTableName, Create create, BufferManager buffer, boolean add) {
      List<ElementSymbol> columns = create.getColumnSymbols();
      TempMetadataID id = tempMetadataStore.getTempGroupID(tempTableName);
      if (id == null) {
          //add metadata
        id = tempMetadataStore.addTempGroup(tempTableName, columns, false, true);
          TempTableResolver.addAdditionalMetadata(create, id);
      }
View Full Code Here

      throws QueryMetadataException, TeiidComponentException, QueryResolverException, QueryValidatorException {
    String matViewName = metadata.getFullName(viewId);
    String matTableName = RelationalPlanner.MAT_PREFIX+matViewName.toUpperCase();
    GroupSymbol group = new GroupSymbol(matViewName);
    group.setMetadataID(viewId);
    TempMetadataID id = tempMetadataStore.getTempGroupID(matTableName);
    //define the table preserving the key/index information and ensure that only a single instance exists
    if (id == null) {
      synchronized (viewId) {
        id = tempMetadataStore.getTempGroupID(matTableName);
        if (id == null) {
          id = tempMetadataStore.addTempGroup(matTableName, ResolverUtil.resolveElementsInGroup(group, metadata), false, true);
          id.setQueryNode(metadata.getVirtualPlan(viewId));
          id.setCardinality(metadata.getCardinality(viewId));
         
          Object pk = metadata.getPrimaryKey(viewId);
          if (pk != null) {
            ArrayList<TempMetadataID> primaryKey = resolveIndex(metadata, id, pk);
            id.setPrimaryKey(primaryKey);
          }
          Collection keys = metadata.getUniqueKeysInGroup(viewId);
          for (Object key : keys) {
            id.addUniqueKey(resolveIndex(metadata, id, key));
          }
          Collection indexes = metadata.getIndexesInGroup(viewId);
          for (Object index : indexes) {
            id.addIndex(resolveIndex(metadata, id, index));
          }
        }
      }
    }
    updateCacheHint(viewId, metadata, group, id);
View Full Code Here

          if (metadata.getMetadata().hasProcedure(group.getName())) {
            throw new QueryResolverException(QueryPlugin.Util.getString("TempTableResolver.table_already_exists", group.getName())); //$NON-NLS-1$
          }
           
            //now we will be more specific for temp groups
            TempMetadataID id = metadata.getMetadataStore().getTempGroupID(group.getName());
            if (id != null && !metadata.isTemporaryTable(id)) {
                throw new QueryResolverException(QueryPlugin.Util.getString("TempTableResolver.table_already_exists", group.getName())); //$NON-NLS-1$       
            }
            //if we get here then either the group does not exist or has already been defined as a temp table
            //if it has been defined as a temp table, that's ok we'll use this as the new definition and throw an
            //exception at runtime if the user has not dropped the previous table yet
            TempMetadataID tempTable = ResolverUtil.addTempTable(metadata, group, create.getColumnSymbols());
            ResolverUtil.resolveGroup(create.getTable(), metadata);
            Set<GroupSymbol> groups = new HashSet<GroupSymbol>();
            groups.add(create.getTable());
            ResolverVisitor.resolveLanguageObject(command, groups, metadata);
            addAdditionalMetadata(create, tempTable);
View Full Code Here

TOP

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

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.