@Override public String getName(Object metadataID) throws TeiidComponentException, QueryMetadataException { if(metadataID instanceof TempMetadataID) { TempMetadataID tid = (TempMetadataID)metadataID; return tid.getName(); } return this.actualMetadata.getName(metadataID); }
@Override public String getName(Object metadataID) throws TeiidComponentException, QueryMetadataException { if(metadataID instanceof TempMetadataID) { TempMetadataID tid = (TempMetadataID)metadataID; return tid.getName(); } return this.actualMetadata.getName(metadataID); }
@Override public String getName(Object metadataID) throws TeiidComponentException, QueryMetadataException { if(metadataID instanceof TempMetadataID) { TempMetadataID tid = (TempMetadataID)metadataID; return tid.getName(); } return this.actualMetadata.getName(metadataID); }
@Override public Object get(int index) { return vc.getValue(new ElementSymbol(cols.get(index).getName(), leftRowValue)); } };
@Override public Object get(int index) { return vc.getValue(new ElementSymbol(cols.get(index).getName(), leftRowValue)); } };
private void checkForSharedSourceCommand(AccessNode aNode) { //create a top level key to avoid the full command toString String modelName = aNode.getModelName(); Command cmd = aNode.getCommand(); //don't share full scans against internal sources, it's a waste of buffering if (CoreConstants.SYSTEM_MODEL.equals(modelName) || CoreConstants.SYSTEM_ADMIN_MODEL.equals(modelName) || TempMetadataAdapter.TEMP_MODEL.getName().equals(modelName)) { if (!(cmd instanceof Query)) { return; } Query query = (Query)cmd; if (query.getOrderBy() == null && query.getCriteria() == null) { return; } } AccessNode other = sharedCommands.get(cmd); if (other == null) { sharedCommands.put(cmd, aNode); } else { if (other.info == null) { other.info = new RegisterRequestParameter.SharedAccessInfo(); other.info.id = sharedId.getAndIncrement(); } other.info.sharingCount++; aNode.info = other.info; } }
public QueryNode getVirtualPlan(Object groupID) throws TeiidComponentException, QueryMetadataException { if (this.queryNodes != null) { QueryNode node = this.queryNodes.get(groupID); if (node != null) { return node; } } if(groupID instanceof TempMetadataID && !(actualMetadata instanceof TempMetadataAdapter)) { TempMetadataID tid = (TempMetadataID)groupID; QueryNode queryNode = tid.getQueryNode(); if (queryNode != null) { return queryNode; } throw new QueryMetadataException(QueryPlugin.Event.TEIID31265, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID31265, tid.getName())); } return this.actualMetadata.getVirtualPlan(groupID); }
public QueryNode getVirtualPlan(Object groupID) throws TeiidComponentException, QueryMetadataException { if (this.queryNodes != null) { QueryNode node = this.queryNodes.get(groupID); if (node != null) { return node; } } if(groupID instanceof TempMetadataID && !(actualMetadata instanceof TempMetadataAdapter)) { TempMetadataID tid = (TempMetadataID)groupID; QueryNode queryNode = tid.getQueryNode(); if (queryNode != null) { return queryNode; } throw new QueryMetadataException(QueryPlugin.Event.TEIID31265, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID31265, tid.getName())); } return this.actualMetadata.getVirtualPlan(groupID); }
colTypes = new ArrayList<Class<?>>(); colNames.add(col.getName()); colTypes.add(col.getType()); break;
colTypes = new ArrayList<Class<?>>(); colNames.add(col.getName()); colTypes.add(col.getType()); break;
colTypes = new ArrayList<Class<?>>(); colNames.add(col.getName()); colTypes.add(col.getType()); break;
|| TempMetadataAdapter.TEMP_MODEL.getName().equals(modelName)) { if (!(cmd instanceof Query)) { return;
/** * Remove unused projects by replacing with null * @param with * @param subCommand * @param elements * @param toRemove * @return * @throws QueryMetadataException * @throws QueryResolverException * @throws TeiidComponentException */ private Query removeUnusedProjection(WithQueryCommand with, QueryCommand subCommand, List<TempMetadataID> elements, List<Integer> toRemove) throws QueryMetadataException, QueryResolverException, TeiidComponentException { Query query = null; if (!(subCommand instanceof Query) || subCommand.getOrderBy() != null) { GroupSymbol gs = new GroupSymbol("x"); //$NON-NLS-1$ gs = RulePlaceAccess.recontextSymbol(gs, context.getGroups()); query = QueryRewriter.createInlineViewQuery(gs, subCommand, metadata, ResolverUtil.resolveElementsInGroup(with.getGroupSymbol(), metadata)); } else { query = (Query)subCommand; } for (int i : toRemove) { query.getSelect().getSymbols().set(i, new ExpressionSymbol(elements.get(i).getName(), new Constant(null, elements.get(i).getType()))); } return query; }
/** * Remove unused projects by replacing with null * @param with * @param subCommand * @param elements * @param toRemove * @return * @throws QueryMetadataException * @throws QueryResolverException * @throws TeiidComponentException */ private Query removeUnusedProjection(WithQueryCommand with, QueryCommand subCommand, List<TempMetadataID> elements, List<Integer> toRemove) throws QueryMetadataException, QueryResolverException, TeiidComponentException { Query query = null; if (!(subCommand instanceof Query) || subCommand.getOrderBy() != null) { GroupSymbol gs = new GroupSymbol("x"); //$NON-NLS-1$ gs = RulePlaceAccess.recontextSymbol(gs, context.getGroups()); query = QueryRewriter.createInlineViewQuery(gs, subCommand, metadata, ResolverUtil.resolveElementsInGroup(with.getGroupSymbol(), metadata)); } else { query = (Query)subCommand; } for (int i : toRemove) { query.getSelect().getSymbols().set(i, new ExpressionSymbol(elements.get(i).getName(), new Constant(null, elements.get(i).getType()))); } return query; }
TupleSource result = this.dataManager.registerRequest(this.internalProcessor.getContext(), insert, TempMetadataAdapter.TEMP_MODEL.getName(), new RegisterRequestParameter()); result.nextTuple(); doneLoading = true; AlterTempTable att = new AlterTempTable(tempTable); this.dataManager.registerRequest(this.internalProcessor.getContext(), att, TempMetadataAdapter.TEMP_MODEL.getName(), new RegisterRequestParameter()); this.tupleSource = this.dataManager.registerRequest(this.internalProcessor.getContext(), this.resultInfo.getTempSelect(), TempMetadataAdapter.TEMP_MODEL.getName(), new RegisterRequestParameter()); this.dataManager.registerRequest(this.internalProcessor.getContext(), att, TempMetadataAdapter.TEMP_MODEL.getName(), new RegisterRequestParameter());
/** * Close the executor and release all the resources. */ public void close() throws TeiidComponentException { this.internalProcessor.closeProcessing(); if (this.tupleSource != null) { this.tupleSource.closeSource(); } String rsTempTable = this.resultInfo.getTempTable(); if (rsTempTable != null) { LogManager.logDetail(LogConstants.CTX_XML_PLAN, "Unloading result set temp table", rsTempTable); //$NON-NLS-1$ internalProcessor.closeProcessing(); try { this.tupleSource = this.dataManager.registerRequest(this.internalProcessor.getContext(), this.resultInfo.getTempDrop(), TempMetadataAdapter.TEMP_MODEL.getName(), new RegisterRequestParameter()); } catch (TeiidProcessingException e) { LogManager.logDetail(org.teiid.logging.LogConstants.CTX_XML_PLAN, e, "Error dropping result set temp table", rsTempTable); //$NON-NLS-1$ } } LogManager.logTrace(org.teiid.logging.LogConstants.CTX_XML_PLAN, new Object[]{"closed executor", resultInfo.getResultSetName()}); //$NON-NLS-1$ }
/** * @see org.teiid.query.processor.xml.ProcessorInstruction#process(org.teiid.query.processor.xml.XMLProcessorEnvironment, org.teiid.query.processor.xml.XMLContext) */ public XMLContext process(XMLProcessorEnvironment env, XMLContext context) throws BlockedException, TeiidComponentException, TeiidProcessingException { if (!env.isStagingTableLoaded(this.resultSetName)) { super.execute(env, context); env.markStagingTableAsLoaded(this.resultSetName); if (!info.isAutoStaged() && info.getTempTable() == null && info.getCommand() instanceof Insert) { //TODO: should consolidate with the other temp logic in RelationalPlanExecutor AlterTempTable att = new AlterTempTable(XMLQueryPlanner.getTempTableName(this.resultSetName)); att.setIndexColumns(this.info.getFkColumns()); //mark the temp table as non-updatable env.getDataManager().registerRequest(env.getProcessorContext(), att, TempMetadataAdapter.TEMP_MODEL.getName(), new RegisterRequestParameter()); } // now that we done executing the plan; remove the plan from context context.removeResultExecutor(resultSetName); } env.incrementCurrentProgramCounter(); return context; }
iterations++; if (maxIterations > 0 && iterations > maxIterations) { throw new TeiidProcessingException(QueryPlugin.Event.TEIID31158, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID31158, maxIterations, tempTable.getMetadataId().getName()));
iterations++; if (maxIterations > 0 && iterations > maxIterations) { throw new TeiidProcessingException(QueryPlugin.Event.TEIID31158, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID31158, maxIterations, tempTable.getMetadataId().getName()));
iterations++; if (maxIterations > 0 && iterations > maxIterations) { throw new TeiidProcessingException(QueryPlugin.Event.TEIID31158, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID31158, maxIterations, tempTable.getMetadataId().getName()));