public static Boolean requiresTransaction(boolean transactionalReads, List<SubqueryContainer<?>> valueIteratorProviders) { for (SubqueryContainer<?> subquery : valueIteratorProviders) { ProcessorPlan plan = subquery.getCommand().getProcessorPlan(); if (plan != null) { Boolean txn = plan.requiresTransaction(transactionalReads); if (txn == null || txn) { return true; //we can't ensure that this is read only } } } return false; }
public static Boolean requiresTransaction(boolean transactionalReads, List<SubqueryContainer<?>> valueIteratorProviders) { for (SubqueryContainer<?> subquery : valueIteratorProviders) { ProcessorPlan plan = subquery.getCommand().getProcessorPlan(); if (plan != null) { Boolean txn = plan.requiresTransaction(transactionalReads); if (txn == null || txn) { return true; //we can't ensure that this is read only } } } return false; }
public static Boolean requiresTransaction(boolean transactionalReads, List<SubqueryContainer<?>> valueIteratorProviders) { for (SubqueryContainer<?> subquery : valueIteratorProviders) { ProcessorPlan plan = subquery.getCommand().getProcessorPlan(); if (plan != null) { Boolean txn = plan.requiresTransaction(transactionalReads); if (txn == null || txn) { return true; //we can't ensure that this is read only } } } return false; }
public static void addLanaguageObjects(PlanNode node, String key, Collection<? extends LanguageObject> objects) { List<String> values = new ArrayList<String>(); int index = 0; for (LanguageObject languageObject : objects) { values.add(languageObject.toString()); List<SubqueryContainer<?>> subqueries = ValueIteratorProviderCollectorVisitor.getValueIteratorProviders(languageObject); for (ListIterator<SubqueryContainer<?>> iterator = subqueries.listIterator(); iterator.hasNext();) { SubqueryContainer<?> subqueryContainer = iterator.next(); node.addProperty(key + " Subplan " + index++, subqueryContainer.getCommand().getProcessorPlan().getDescriptionProperties()); //$NON-NLS-1$ } } node.addProperty(key, values); } }
public static void addLanaguageObjects(PlanNode node, String key, Collection<? extends LanguageObject> objects) { List<String> values = new ArrayList<String>(); int index = 0; for (LanguageObject languageObject : objects) { values.add(languageObject.toString()); List<SubqueryContainer<?>> subqueries = ValueIteratorProviderCollectorVisitor.getValueIteratorProviders(languageObject); for (ListIterator<SubqueryContainer<?>> iterator = subqueries.listIterator(); iterator.hasNext();) { SubqueryContainer<?> subqueryContainer = iterator.next(); node.addProperty(key + " Subplan " + index++, subqueryContainer.getCommand().getProcessorPlan().getDescriptionProperties()); //$NON-NLS-1$ } } node.addProperty(key, values); } }
public static void addLanaguageObjects(PlanNode node, String key, Collection<? extends LanguageObject> objects) { List<String> values = new ArrayList<String>(); int index = 0; for (LanguageObject languageObject : objects) { values.add(languageObject.toString()); List<SubqueryContainer<?>> subqueries = ValueIteratorProviderCollectorVisitor.getValueIteratorProviders(languageObject); for (ListIterator<SubqueryContainer<?>> iterator = subqueries.listIterator(); iterator.hasNext();) { SubqueryContainer<?> subqueryContainer = iterator.next(); node.addProperty(key + " Subplan " + index++, subqueryContainer.getCommand().getProcessorPlan().getDescriptionProperties()); //$NON-NLS-1$ } } node.addProperty(key, values); } }
/** * Returns whether a command can be placed in a connector batch * @param command an update command * @param metadata * @return true if this command can be added to a batch; false otherwise * @throws QueryMetadataException * @throws TeiidComponentException * @since 4.2 */ public static boolean isEligibleForBatching(Command command, QueryMetadataInterface metadata) throws QueryMetadataException, TeiidComponentException { ProcessorPlan plan = command.getProcessorPlan(); AccessNode aNode = CriteriaCapabilityValidatorVisitor.getAccessNode(plan); // If the command updates a physical group, it's eligible return aNode != null && !metadata.isVirtualGroup(getUpdatedGroup(command).getMetadataID()); }
/** * Returns whether a command can be placed in a connector batch * @param command an update command * @param metadata * @return true if this command can be added to a batch; false otherwise * @throws QueryMetadataException * @throws TeiidComponentException * @since 4.2 */ public static boolean isEligibleForBatching(Command command, QueryMetadataInterface metadata) throws QueryMetadataException, TeiidComponentException { ProcessorPlan plan = command.getProcessorPlan(); AccessNode aNode = CriteriaCapabilityValidatorVisitor.getAccessNode(plan); // If the command updates a physical group, it's eligible return aNode != null && !metadata.isVirtualGroup(getUpdatedGroup(command).getMetadataID()); }
/** * @param removeOrderBy * @param assStmt * @throws QueryValidatorException */ private void rewriteSubqueryContainer(SubqueryContainer container, boolean removeOrderBy) throws TeiidComponentException, TeiidProcessingException{ if (rewriteSubcommands && container.getCommand() != null && (container.getCommand().getProcessorPlan() == null || processing)) { container.setCommand(rewriteCommand(container.getCommand(), removeOrderBy)); } }
/** * @param removeOrderBy * @param assStmt * @throws QueryValidatorException */ private void rewriteSubqueryContainer(SubqueryContainer container, boolean removeOrderBy) throws TeiidComponentException, TeiidProcessingException{ if (rewriteSubcommands && container.getCommand() != null && (container.getCommand().getProcessorPlan() == null || processing)) { container.setCommand(rewriteCommand(container.getCommand(), removeOrderBy)); } }
/** * @param removeOrderBy * @param assStmt * @throws QueryValidatorException */ private void rewriteSubqueryContainer(SubqueryContainer container, boolean removeOrderBy) throws TeiidComponentException, TeiidProcessingException{ if (rewriteSubcommands && container.getCommand() != null && (container.getCommand().getProcessorPlan() == null || processing)) { container.setCommand(rewriteCommand(container.getCommand(), removeOrderBy)); } }
continue; ProcessorPlan plan = container.getCommand().getProcessorPlan(); if (plan == null) { continue;
public synchronized PlanNode getDescriptionProperties() { if (getChildCount() > 0) { return this.getChildren()[0].getDescriptionProperties(); } PlanNode props = super.getDescriptionProperties(); props.addProperty(PROP_SQL, this.command.toString()); props.addProperty(PROP_MODEL_NAME, this.modelName); Collection<? extends SubqueryContainer<?>> objects = getObjects(); if (!objects.isEmpty()) { int index = 0; for (Iterator<? extends SubqueryContainer<?>> iterator = objects.iterator(); iterator.hasNext();) { SubqueryContainer<?> subqueryContainer = iterator.next(); props.addProperty(PROP_SQL + " Subplan " + index++, subqueryContainer.getCommand().getProcessorPlan().getDescriptionProperties()); //$NON-NLS-1$ } } if (this.projection != null && this.projection.length > 0 && this.originalSelect != null) { props.addProperty(PROP_SELECT_COLS, this.originalSelect.toString()); } if (this.info != null) { props.addProperty(PROP_SHARING_ID, String.valueOf(this.info.id)); } if (this.subPlans != null) { for (Map.Entry<GroupSymbol, RelationalPlan> entry : this.subPlans.entrySet()) { props.addProperty(entry.getKey() + " Dependent Subplan", entry.getValue().getDescriptionProperties()); //$NON-NLS-1$ } } return props; }
public synchronized PlanNode getDescriptionProperties() { if (getChildCount() > 0) { return this.getChildren()[0].getDescriptionProperties(); } PlanNode props = super.getDescriptionProperties(); props.addProperty(PROP_SQL, this.command.toString()); props.addProperty(PROP_MODEL_NAME, this.modelName); Collection<? extends SubqueryContainer<?>> objects = getObjects(); if (!objects.isEmpty()) { int index = 0; for (Iterator<? extends SubqueryContainer<?>> iterator = objects.iterator(); iterator.hasNext();) { SubqueryContainer<?> subqueryContainer = iterator.next(); props.addProperty(PROP_SQL + " Subplan " + index++, subqueryContainer.getCommand().getProcessorPlan().getDescriptionProperties()); //$NON-NLS-1$ } } if (this.projection != null && this.projection.length > 0 && this.originalSelect != null) { props.addProperty(PROP_SELECT_COLS, this.originalSelect.toString()); } if (this.info != null) { props.addProperty(PROP_SHARING_ID, String.valueOf(this.info.id)); } if (this.subPlans != null) { for (Map.Entry<GroupSymbol, RelationalPlan> entry : this.subPlans.entrySet()) { props.addProperty(entry.getKey() + " Dependent Subplan", entry.getValue().getDescriptionProperties()); //$NON-NLS-1$ } } return props; }
public static void prepareSubquery(SubqueryContainer container) { RelationalPlan subqueryPlan = (RelationalPlan)container.getCommand().getProcessorPlan(); AccessNode aNode = CriteriaCapabilityValidatorVisitor.getAccessNode(subqueryPlan); QueryCommand command = CriteriaCapabilityValidatorVisitor.getQueryCommand(aNode); if (command == null) { return; } final SymbolMap map = container.getCommand().getCorrelatedReferences(); if (map != null) { ExpressionMappingVisitor visitor = new RuleMergeCriteria.ReferenceReplacementVisitor(map); DeepPostOrderNavigator.doVisit(command, visitor); } command.setProcessorPlan(container.getCommand().getProcessorPlan()); boolean removeLimit = false; if (container instanceof ExistsCriteria) { removeLimit = !((ExistsCriteria)container).shouldEvaluate(); } else if (container instanceof ScalarSubquery) { removeLimit = !((ScalarSubquery)container).shouldEvaluate(); } if (removeLimit && command.getLimit() != null && command.getLimit().isImplicit()) { command.setLimit(null); } container.setCommand(command); }
public static void prepareSubquery(SubqueryContainer container) { RelationalPlan subqueryPlan = (RelationalPlan)container.getCommand().getProcessorPlan(); AccessNode aNode = CriteriaCapabilityValidatorVisitor.getAccessNode(subqueryPlan); QueryCommand command = CriteriaCapabilityValidatorVisitor.getQueryCommand(aNode); if (command == null) { return; } final SymbolMap map = container.getCommand().getCorrelatedReferences(); if (map != null) { ExpressionMappingVisitor visitor = new RulePlanSubqueries.ReferenceReplacementVisitor(map); DeepPostOrderNavigator.doVisit(command, visitor); } command.setProcessorPlan(container.getCommand().getProcessorPlan()); boolean removeLimit = false; if (container instanceof ExistsCriteria) { removeLimit = !((ExistsCriteria)container).shouldEvaluate(); } else if (container instanceof ScalarSubquery) { removeLimit = !((ScalarSubquery)container).shouldEvaluate(); } if (removeLimit && command.getLimit() != null && command.getLimit().isImplicit()) { command.setLimit(null); } container.setCommand(command); }
public static void prepareSubquery(SubqueryContainer container) { RelationalPlan subqueryPlan = (RelationalPlan)container.getCommand().getProcessorPlan(); AccessNode aNode = CriteriaCapabilityValidatorVisitor.getAccessNode(subqueryPlan); QueryCommand command = CriteriaCapabilityValidatorVisitor.getQueryCommand(aNode); if (command == null) { return; } final SymbolMap map = container.getCommand().getCorrelatedReferences(); if (map != null) { ExpressionMappingVisitor visitor = new RulePlanSubqueries.ReferenceReplacementVisitor(map); DeepPostOrderNavigator.doVisit(command, visitor); } command.setProcessorPlan(container.getCommand().getProcessorPlan()); boolean removeLimit = false; if (container instanceof ExistsCriteria) { removeLimit = !((ExistsCriteria)container).shouldEvaluate(); } else if (container instanceof ScalarSubquery) { removeLimit = !((ScalarSubquery)container).shouldEvaluate(); } if (removeLimit && command.getLimit() != null && command.getLimit().isImplicit()) { command.setLimit(null); } container.setCommand(command); }
if (subqueryContainer.getCommand().getProcessorPlan() == null) { Command subCommand = initial?(Command) subqueryContainer.getCommand().clone():subqueryContainer.getCommand(); ProcessorPlan plan = QueryOptimizer.optimizePlan(subCommand, metadata, null, capFinder, analysisRecord, context);
if (subqueryContainer.getCommand().getProcessorPlan() == null) { Command subCommand = initial?(Command) subqueryContainer.getCommand().clone():subqueryContainer.getCommand(); ProcessorPlan plan = QueryOptimizer.optimizePlan(subCommand, metadata, null, capFinder, analysisRecord, context);
if (subqueryContainer.getCommand().getProcessorPlan() == null) { Command subCommand = initial?(Command) subqueryContainer.getCommand().clone():subqueryContainer.getCommand(); ProcessorPlan plan = QueryOptimizer.optimizePlan(subCommand, metadata, null, capFinder, analysisRecord, context);