Exemplo n.º 1
0
 TempTable addTempTable(
     final String tempTableName,
     Create create,
     BufferManager buffer,
     boolean add,
     CommandContext context)
     throws TeiidProcessingException {
   List<ElementSymbol> columns = create.getColumnSymbols();
   TempMetadataID id = tempMetadataStore.getTempGroupID(tempTableName);
   getSynchronization(context);
   if (id == null) {
     // add metadata
     id = tempMetadataStore.addTempGroup(tempTableName, columns, false, true);
     TempTableResolver.addAdditionalMetadata(create, id);
   }
   columns = new ArrayList<ElementSymbol>(create.getColumnSymbols());
   if (!create.getPrimaryKey().isEmpty()) {
     // reorder the columns to put the key in front
     List<ElementSymbol> primaryKey = create.getPrimaryKey();
     columns.removeAll(primaryKey);
     columns.addAll(0, primaryKey);
   }
   final TempTable tempTable =
       new TempTable(id, buffer, columns, create.getPrimaryKey().size(), sessionID);
   if (add) {
     tempTables.put(tempTableName, tempTable);
   }
   return tempTable;
 }
Exemplo n.º 2
0
 void addForeignTempTable(final String tempTableName, Create create) {
   TempMetadataID id = tempMetadataStore.getTempGroupID(tempTableName);
   if (id == null) {
     id = tempMetadataStore.addTempGroup(tempTableName, create.getColumnSymbols(), false, true);
     id.setOriginalMetadataID(create.getTableMetadata());
     id.getTableData().setModel(create.getTableMetadata().getParent());
   }
   this.foreignTempTables.put(tempTableName, create.getTableMetadata());
 }