public static void setChildMetadata(Command subCommand, Command parent) { TempMetadataStore childMetadata = parent.getTemporaryMetadata(); GroupContext parentContext = parent.getExternalGroupContexts(); setChildMetadata(subCommand, childMetadata, parentContext); }
public static void setChildMetadata(Command subCommand, Command parent) { TempMetadataStore childMetadata = parent.getTemporaryMetadata(); GroupContext parentContext = parent.getExternalGroupContexts(); setChildMetadata(subCommand, childMetadata, parentContext); }
public static void setChildMetadata(Command subCommand, Command parent) { TempMetadataStore childMetadata = parent.getTemporaryMetadata(); GroupContext parentContext = parent.getExternalGroupContexts(); setChildMetadata(subCommand, childMetadata, parentContext); }
private static void setTempMetadata(final QueryMetadataInterface metadata, final AbstractValidationVisitor visitor, LanguageObject obj) { if (obj instanceof Command) { Command command = (Command)obj; visitor.currentCommand = command; TempMetadataStore tempMetadata = command.getTemporaryMetadata(); if(tempMetadata != null && !tempMetadata.getData().isEmpty()) { visitor.setMetadata(new TempMetadataAdapter(metadata, tempMetadata)); } } }
private static void setTempMetadata(final QueryMetadataInterface metadata, final AbstractValidationVisitor visitor, LanguageObject obj) { if (obj instanceof Command) { Command command = (Command)obj; visitor.currentCommand = command; TempMetadataStore tempMetadata = command.getTemporaryMetadata(); if(tempMetadata != null && !tempMetadata.getData().isEmpty()) { visitor.setMetadata(new TempMetadataAdapter(metadata, tempMetadata)); } } }
private static void setTempMetadata(final QueryMetadataInterface metadata, final AbstractValidationVisitor visitor, LanguageObject obj) { if (obj instanceof Command) { Command command = (Command)obj; visitor.currentCommand = command; TempMetadataStore tempMetadata = command.getTemporaryMetadata(); if(tempMetadata != null && !tempMetadata.getData().isEmpty()) { visitor.setMetadata(new TempMetadataAdapter(metadata, tempMetadata)); } } }
/** * Adds temp metadata (if any) of child command to temp metadata * (if any) of parent command. * @param childCommand * @param parentCommand */ static void mergeTempMetadata( Command childCommand, Command parentCommand) { TempMetadataStore childTempMetadata = childCommand.getTemporaryMetadata(); if (childTempMetadata != null && !childTempMetadata.getData().isEmpty()){ // Add to parent temp metadata TempMetadataStore parentTempMetadata = parentCommand.getTemporaryMetadata(); if (parentTempMetadata == null){ parentCommand.setTemporaryMetadata(childTempMetadata); } else { parentTempMetadata.getData().putAll(childTempMetadata.getData()); } } }
/** * Adds temp metadata (if any) of child command to temp metadata * (if any) of parent command. * @param childCommand * @param parentCommand */ static void mergeTempMetadata( Command childCommand, Command parentCommand) { TempMetadataStore childTempMetadata = childCommand.getTemporaryMetadata(); if (childTempMetadata != null && !childTempMetadata.getData().isEmpty()){ // Add to parent temp metadata TempMetadataStore parentTempMetadata = parentCommand.getTemporaryMetadata(); if (parentTempMetadata == null){ parentCommand.setTemporaryMetadata(childTempMetadata); } else { parentTempMetadata.getData().putAll(childTempMetadata.getData()); } } }
/** * Adds temp metadata (if any) of child command to temp metadata * (if any) of parent command. * @param childCommand * @param parentCommand */ static void mergeTempMetadata( Command childCommand, Command parentCommand) { TempMetadataStore childTempMetadata = childCommand.getTemporaryMetadata(); if (childTempMetadata != null && !childTempMetadata.getData().isEmpty()){ // Add to parent temp metadata TempMetadataStore parentTempMetadata = parentCommand.getTemporaryMetadata(); if (parentTempMetadata == null){ parentCommand.setTemporaryMetadata(childTempMetadata); } else { parentTempMetadata.getData().putAll(childTempMetadata.getData()); } } }
private Map<Integer, Object>[] createProjectedSymbolMetadata(Command originalCommand) throws TeiidComponentException { Map<Integer, Object>[] columnMetadata; // Allow command to use temporary metadata TempMetadataStore tempMetadata = originalCommand.getTemporaryMetadata(); if(tempMetadata != null && tempMetadata.getData().size() > 0) { TempMetadataAdapter tempFacade = new TempMetadataAdapter(this.metadata, tempMetadata); this.metadata = tempFacade; } List<Expression> projectedSymbols = originalCommand.getProjectedSymbols(); columnMetadata = new Map[projectedSymbols.size()]; Iterator<Expression> symbolIter = projectedSymbols.iterator(); for(int i=0; symbolIter.hasNext(); i++) { Expression symbol = symbolIter.next(); String shortColumnName = Symbol.getShortName(Symbol.getOutputName(symbol)); if(symbol instanceof AliasSymbol) { symbol = ((AliasSymbol)symbol).getSymbol(); } try { columnMetadata[i] = createColumnMetadata(shortColumnName, symbol); } catch(QueryMetadataException e) { throw new TeiidComponentException(QueryPlugin.Event.TEIID30559, e); } } return columnMetadata; }
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); }
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); }
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); }
Map<String, TempMetadataID> tempIDs = command.getTemporaryMetadata().getData(); assertNotNull(tempIDs); assertNull(tempIDs.get("LOOPCURSOR")); //$NON-NLS-1$ tempIDs = subCommand.getTemporaryMetadata().getData(); assertNotNull(tempIDs); assertNull(tempIDs.get("LOOPCURSOR")); //$NON-NLS-1$ tempIDs = subCommand.getTemporaryMetadata().getData(); assertNotNull(tempIDs); assertNotNull(tempIDs.get("LOOPCURSOR")); //$NON-NLS-1$
private Map<Integer, Object>[] createProjectedSymbolMetadata(Command originalCommand) throws TeiidComponentException { Map<Integer, Object>[] columnMetadata; TempMetadataStore tempMetadata = originalCommand.getTemporaryMetadata(); if(tempMetadata != null && tempMetadata.getData().size() > 0) { TempMetadataAdapter tempFacade = new TempMetadataAdapter(this.metadata, tempMetadata);
private void resolveSubQuery(SubqueryContainer<?> obj, Collection<GroupSymbol> externalGroups) { Command command = obj.getCommand(); QueryResolver.setChildMetadata(command, query); command.pushNewResolvingContext(externalGroups); for (GroupSymbol gs : externalGroups) { //subquery from clauses are not valid for resolving against //and they are not caught by later validation like scalar groups //we can directly remove as each command has a copy of the known temp groups if (!gs.isTempTable()) { command.getTemporaryMetadata().removeTempGroup(gs.getName()); } } try { QueryResolver.resolveCommand(command, metadata.getMetadata(), false); } catch (TeiidException err) { throw new TeiidRuntimeException(err); } }
private void resolveSubQuery(SubqueryContainer<?> obj, Collection<GroupSymbol> externalGroups) { Command command = obj.getCommand(); QueryResolver.setChildMetadata(command, query); command.pushNewResolvingContext(externalGroups); for (GroupSymbol gs : externalGroups) { //subquery from clauses are not valid for resolving against //and they are not caught by later validation like scalar groups //we can directly remove as each command has a copy of the known temp groups if (!gs.isTempTable()) { command.getTemporaryMetadata().removeTempGroup(gs.getName()); } } try { QueryResolver.resolveCommand(command, metadata.getMetadata(), false); } catch (TeiidException err) { throw new TeiidRuntimeException(err); } }
TempMetadataStore discoveredMetadata = currentCommand.getTemporaryMetadata(); if(discoveredMetadata == null) { discoveredMetadata = new TempMetadataStore();
TempMetadataStore discoveredMetadata = currentCommand.getTemporaryMetadata(); if(discoveredMetadata == null) { discoveredMetadata = new TempMetadataStore();
TempMetadataStore discoveredMetadata = currentCommand.getTemporaryMetadata(); if(discoveredMetadata == null) { discoveredMetadata = new TempMetadataStore();