public GlobalTableStoreImpl(BufferManager bufferManager, VDBMetaData vdbMetaData, QueryMetadataInterface metadata) { this.bufferManager = bufferManager; this.vdbMetaData = vdbMetaData; this.metadata = new TempMetadataAdapter(metadata, new TempMetadataStore()); }
/** * Add a temp group and all it's elements * @param tempGroup Name of temp group * @param tempSymbols List of ElementSymbol in position order * @param isVirtual whether or not the group is a virtual group */ public TempMetadataID addTempGroup(String tempGroup, List tempSymbols, boolean isVirtual) { return addTempGroup(tempGroup, tempSymbols, isVirtual, false); }
public static void setChildMetadata(Command subCommand, TempMetadataStore parentTempMetadata, GroupContext parentContext) { TempMetadataStore tempMetadata = subCommand.getTemporaryMetadata(); if(tempMetadata == null) { subCommand.setTemporaryMetadata(parentTempMetadata.clone()); } else { tempMetadata.getData().putAll(parentTempMetadata.getData()); } subCommand.setExternalGroupContexts(parentContext); }
TempMetadataID id = metadata.getMetadataStore().getTempGroupID(queryName); metadata.getMetadataStore().addTempGroup(queryName, projectedSymbols, true); id = metadata.getMetadataStore().getTempGroupID(queryName); id.setOriginalMetadataID(storedProcedureCommand.getProcedureID()); if (!accessPatternElementNames.isEmpty()) { accessPatternIds.add(metadata.getMetadataStore().getTempElementID(name));
static String getNewName(String groupName, TempMetadataStore store) { int index = 1; String newGroup = null; while (true) { newGroup = (groupName + "_" + index++).toUpperCase(); //$NON-NLS-1$ if (!store.getData().containsKey(newGroup)) { break; } } return newGroup; }
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()); }
command.setTemporaryMetadata(dynamicCommand.getTemporaryMetadata().clone()); updateContextWithUsingValues(procEnv, localContext); metadataStore.addTempGroup(Reserved.USING, new LinkedList<ElementSymbol>(dynamicCommand.getUsing().getClauseMap().keySet())); GroupSymbol using = new GroupSymbol(Reserved.USING); using.setMetadataID(metadataStore.getTempGroupID(Reserved.USING)); command.addExternalGroupToContext(using); metadataStore.addTempGroup(ProcedureReservedWords.DVARS, new LinkedList<ElementSymbol>(dynamicCommand.getUsing().getClauseMap().keySet())); using = new GroupSymbol(ProcedureReservedWords.DVARS); using.setMetadataID(metadataStore.getTempGroupID(ProcedureReservedWords.DVARS)); command.addExternalGroupToContext(using);
/** * Get temporary element ID based on group and element name parts * @param tempGroup Group name * @param tempElement Short element name * @return Metadata ID or null if not found */ public List<TempMetadataID> getTempElementElementIDs(String tempGroup) { TempMetadataID groupID = getTempGroupID(tempGroup); if(groupID != null) { return groupID.getElements(); } return null; }
/** * Check metadata first, then check temp groups if not found */ public Object getElementID(String elementName) throws TeiidComponentException, QueryMetadataException { Object tempID = null; try { tempID = this.actualMetadata.getElementID(elementName); } catch (QueryMetadataException e) { //ignore } if (tempID == null){ tempID = this.tempStore.getTempElementID(elementName); } if(tempID != null) { return tempID; } throw new QueryMetadataException(QueryPlugin.Event.TEIID30350, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30350, elementName)); }
setQuery.setTemporaryMetadata(firstCommand.getTemporaryMetadata().clone());
/** * Add a element symbol to the already created temp group. If added successfully then it will * return the metadata id for the added element. otherwise it will return null. * @param tempGroup - temp group name * @param symbol - element to be added * @return metadata id. */ public TempMetadataID addElementSymbolToTempGroup(String tempGroup, Expression symbol) { TempMetadataID groupID = this.tempGroups.get(tempGroup); if (groupID != null) { TempMetadataID elementID = createElementSymbol(tempGroup, symbol, false); groupID.addElement(elementID); return elementID; } return null; }
public void removeTempTableByName(final String tempTableName, CommandContext context) throws TeiidProcessingException { TempTableSynchronization synch = getSynchronization(context); tempMetadataStore.removeTempGroup(tempTableName); final TempTable table = this.tempTables.remove(tempTableName); if (table == null) { foreignTempTables.remove(tempTableName); return; } if (transactionMode != TransactionMode.ISOLATE_WRITES || synch == null || !synch.existingTables.contains(table.getId())) { table.remove(); } }
public static void resolveImplicitTempGroup(TempMetadataAdapter metadata, GroupSymbol symbol, List symbols) throws TeiidComponentException, QueryResolverException { if (symbol.isImplicitTempGroupSymbol()) { if (metadata.getMetadataStore().getTempElementElementIDs(symbol.getName())==null) { addTempGroup(metadata, symbol, symbols, true); } ResolverUtil.resolveGroup(symbol, metadata); } }
variable.setMetadataID(id); metadata.getMetadataStore().addElementToTempGroup(ProcedureReservedWords.VARIABLES, variable.clone());
TempMetadataID id = metadata.getMetadataStore().getTempGroupID(queryName); metadata.getMetadataStore().addTempGroup(queryName, projectedSymbols, true); id = metadata.getMetadataStore().getTempGroupID(queryName); id.setOriginalMetadataID(storedProcedureCommand.getProcedureID()); if (!accessPatternElementNames.isEmpty()) { accessPatternIds.add(metadata.getMetadataStore().getTempElementID(name));
public void addToGlobalMetadata(Map<String, TempMetadataID> data) { this.globalTempMetadata.getData().putAll(data); }
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()); }
@Override public TempMetadataID getGlobalTempTableMetadataId(String matTableName) { return this.tableStore.getMetadataStore().getTempGroupID(matTableName); }
/** * Check metadata first, then check temp groups if not found */ public Object getElementID(String elementName) throws TeiidComponentException, QueryMetadataException { Object tempID = null; try { tempID = this.actualMetadata.getElementID(elementName); } catch (QueryMetadataException e) { //ignore } if (tempID == null){ tempID = this.tempStore.getTempElementID(elementName); } if(tempID != null) { return tempID; } throw new QueryMetadataException(QueryPlugin.Event.TEIID30350, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30350, elementName)); }
setQuery.setTemporaryMetadata(firstCommand.getTemporaryMetadata().clone());