Package org.teiid.query.metadata

Examples of org.teiid.query.metadata.TempMetadataID


      }
      tempTable.setPrimaryKey(primaryKey);
    }
    for (int i = 0; i < create.getColumns().size(); i++) {
      Column column = create.getColumns().get(i);
      TempMetadataID tid = tempTable.getElements().get(i);
      if (column.isAutoIncremented()) {
        tid.setAutoIncrement(true);
      }
      if (column.getNullType() == NullType.No_Nulls) {
        tid.setNotNull(true);
      }
    }
  }
View Full Code Here


      QueryMetadataInterface metadata = context.getMetadata();
     
      keyElement.setType(DataTypeManager.getDataTypeClass(metadata.getElementType(metadata.getElementID(codeTableName + ElementSymbol.SEPARATOR + keyElementName))));
      returnElement.setType(DataTypeManager.getDataTypeClass(metadata.getElementType(metadata.getElementID(codeTableName + ElementSymbol.SEPARATOR + returnElementName))));
     
      TempMetadataID id = context.getGlobalTableStore().getMetadataStore().getTempGroupID(matTableName);
      if (id == null) {
        id = context.getGlobalTableStore().getMetadataStore().addTempGroup(matTableName, Arrays.asList(keyElement, returnElement), false, true);
        String queryString = Reserved.SELECT + ' ' + keyElementName + " ," + returnElementName + ' ' + Reserved.FROM + ' ' + codeTableName; //$NON-NLS-1$
        id.setQueryNode(new QueryNode(queryString));
        id.setPrimaryKey(id.getElements().subList(0, 1));
        CacheHint hint = new CacheHint(true, null);
        id.setCacheHint(hint);
      }
      Query query = RelationalPlanner.createMatViewQuery(id, matTableName, Arrays.asList(returnElement), true);
      query.setCriteria(new CompareCriteria(keyElement, CompareCriteria.EQ, new Constant(keyValue)));
     
      TupleSource ts = registerQuery(context, context.getTempTableStore(), query);
View Full Code Here

    this.columnMap = RelationalNode.createLookupMap(columns);
    this.columns = columns;
    if (!tid.getElements().isEmpty()) {
      //not relevant for indexes
      for (int i = startIndex; i < columns.size(); i++) {
        TempMetadataID col = tid.getElements().get(i - startIndex);
        if (col.isAutoIncrement()) {
          if (this.sequences == null) {
            this.sequences = new HashMap<Integer, AtomicInteger>();
          }
          sequences.put(i, new AtomicInteger(1));
        }
        if (col.isNotNull()) {
          notNull.add(i);
        }
      }
    }
    if (this.sequences == null) {
View Full Code Here

    for (ElementSymbol elementSymbol : keyColumns) {
      if (allColumns.indexOf(elementSymbol) < 0) {
        allColumns.add(elementSymbol);
      }
    }
    TempTable indexTable = new TempTable(new TempMetadataID("idx", Collections.EMPTY_LIST), this.bm, allColumns, allColumns.size(), this.sessionID); //$NON-NLS-1$
    indexTable.setPreferMemory(this.tree.isPreferMemory());
    indexTable.lock = this.lock;
    if (unique) {
      indexTable.uniqueColIndex = indexColumns.size();
    }
View Full Code Here

          if (!foundNames.add(ses.getShortCanonicalName())) {
              throw new QueryResolverException(QueryPlugin.Util.getString("SimpleQueryResolver.Proc_Relational_Name_conflict", fullName)); //$NON-NLS-1$                           
          }
      }
     
      TempMetadataID id = metadata.getMetadataStore().getTempGroupID(queryName);

      if (id == null) {
          metadata.getMetadataStore().addTempGroup(queryName, projectedSymbols, true);
         
          id = metadata.getMetadataStore().getTempGroupID(queryName);
          id.setOriginalMetadataID(storedProcedureCommand.getProcedureID());
          if (!accessPatternElementNames.isEmpty()) {
            List<TempMetadataID> accessPatternIds = new LinkedList<TempMetadataID>();
           
            for (String name : accessPatternElementNames) {
                accessPatternIds.add(metadata.getMetadataStore().getTempElementID(name));
            }
           
            id.setAccessPatterns(Arrays.asList(new TempMetadataID("procedure access pattern", accessPatternIds))); //$NON-NLS-1$
          }
      }
     
      group.setMetadataID(id);
     
View Full Code Here

          Object matMetadataId = metadata.getMaterialization(metadataID);
          String matTableName = null;
          CacheHint hint = null;
          boolean isImplicitGlobal = matMetadataId == null;
            if (isImplicitGlobal) {
            TempMetadataID tid = context.getGlobalTableStore().getGlobalTempTableMetadataId(metadataID, metadata);
            matTableName = tid.getID();
            hint = tid.getCacheHint();
            if (hint != null) {
          recordAnnotation(analysisRecord, Annotation.MATERIALIZED_VIEW, Priority.LOW, "SimpleQueryResolver.cache_hint_used", virtualGroup, matTableName, tid); //$NON-NLS-1$
        }         
            matMetadataId = tid;
            } else {
View Full Code Here

       
    public void visit(ElementSymbol obj) {
      //if the element is a variable, or an element that will have a value, it will be evaluatable at runtime
    //begin hack for not having the metadata passed in
    if (obj.getGroupSymbol().getMetadataID() instanceof TempMetadataID) {
      TempMetadataID tid = (TempMetadataID)obj.getGroupSymbol().getMetadataID();
      if (tid.isScalarGroup()) {
        evaluationNotPossible(EvaluationLevel.PROCESSING);
        return;
      }
    }
    evaluationNotPossible(EvaluationLevel.PUSH_DOWN);
View Full Code Here

      //metadata hack
      if (this.expression.getGroupSymbol() == null || !(this.expression.getGroupSymbol().getMetadataID() instanceof TempMetadataID)) {
        return true;
      }
     
      TempMetadataID tid = (TempMetadataID)this.expression.getGroupSymbol().getMetadataID();
      return !tid.isScalarGroup();
    }
View Full Code Here

                ElementSymbol es = iter.next();
                es.setType(singleElementSymbol.getType());
        }
              projectedSymbols = obj.getColumns();
            }
            TempMetadataID id = ResolverUtil.addTempGroup(metadata, obj.getGroupSymbol(), projectedSymbols, true);
            obj.getGroupSymbol().setMetadataID(metadata.getMetadataStore().getTempGroupID(obj.getGroupSymbol().getName()));
            obj.getGroupSymbol().setIsTempTable(true);
            List<GroupSymbol> groups = Collections.singletonList(obj.getGroupSymbol());
            if (obj.getColumns() != null && !obj.getColumns().isEmpty()) {
              for (SingleElementSymbol singleElementSymbol : projectedSymbols) {
                  ResolverVisitor.resolveLanguageObject(singleElementSymbol, groups, metadata);
        }
            }
            if (obj.getColumns() != null && !obj.getColumns().isEmpty()) {
              Iterator<ElementSymbol> iter = obj.getColumns().iterator();
                for (TempMetadataID colid : id.getElements()) {
                ElementSymbol es = iter.next();
                es.setMetadataID(colid);
                es.setGroupSymbol(obj.getGroupSymbol());
        }
            }
View Full Code Here

        TempMetadataAdapter tma = new TempMetadataAdapter(metadata, store);
        if (nested instanceof QueryCommand) {
          Query firstProject = ((QueryCommand)nested).getProjectedQuery();
          makeSelectUnique(firstProject.getSelect(), false);
        }
        TempMetadataID gid = store.addTempGroup(inlineGroup.getName(), nested.getProjectedSymbols());
        inlineGroup.setMetadataID(gid);
       
        List<Class<?>> actualTypes = new ArrayList<Class<?>>(nested.getProjectedSymbols().size());
        for (SingleElementSymbol ses : actualSymbols) {
            actualTypes.add(ses.getType());
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.