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; } }
private static void getAtomicCommands(RelationalNode node, Set<Command> atomicQueries) { if(node instanceof AccessNode) { AccessNode accessNode = (AccessNode) node; atomicQueries.add( accessNode.getCommand()); } // Recurse through children RelationalNode[] children = node.getChildren(); for(int i=0; i<children.length; i++) { if(children[i] != null) { getAtomicCommands(children[i], atomicQueries); } else { break; } } }
public static QueryCommand getQueryCommand(AccessNode aNode) { if (aNode == null) { return null; } Command command = aNode.getCommand(); if(!(command instanceof QueryCommand)) { return null; } QueryCommand queryCommand = (QueryCommand)command; if (aNode.getProjection() != null && aNode.getProjection().length > 0) { Query newCommand = (Query)queryCommand.clone(); newCommand.getSelect().setSymbols(aNode.getOriginalSelect()); return newCommand; } return queryCommand; }
public static QueryCommand getQueryCommand(AccessNode aNode) { if (aNode == null) { return null; } Command command = aNode.getCommand(); if(!(command instanceof QueryCommand)) { return null; } QueryCommand queryCommand = (QueryCommand)command; if (aNode.getProjection() != null && aNode.getProjection().length > 0) { Query newCommand = (Query)queryCommand.clone(); newCommand.getSelect().setSymbols(aNode.getOriginalSelect()); return newCommand; } return queryCommand; }
private void checkForSharedSourceCommand(AccessNode aNode, PlanNode node) { Command cmd = aNode.getCommand();
public static QueryCommand getQueryCommand(AccessNode aNode) { if (aNode == null) { return null; } Command command = aNode.getCommand(); if(!(command instanceof QueryCommand)) { return null; } QueryCommand queryCommand = (QueryCommand)command; if (aNode.getProjection() != null && aNode.getProjection().length > 0) { Query newCommand = (Query)queryCommand.clone(); newCommand.getSelect().setSymbols(aNode.getOriginalSelect()); return newCommand; } return queryCommand; }
if (!(anode.getCommand() instanceof Query)) { return; Query query = (Query)anode.getCommand(); if (query.getFrom() == null || query.getFrom().getClauses().size() != 1 || !(query.getFrom().getClauses().get(0) instanceof UnaryFromClause)) { return;
private void checkForSharedSourceCommand(AccessNode aNode, PlanNode node) { Command cmd = aNode.getCommand();
public static Object validateCommandPushdown(Object critNodeModelID, QueryMetadataInterface metadata, CapabilitiesFinder capFinder, AccessNode aNode, boolean considerConformed) throws TeiidComponentException { // Check that query in access node is for the same model as current node try { if (!(aNode.getCommand() instanceof QueryCommand)) { return null; } Object modelID = aNode.getModelId(); if (critNodeModelID == null) { critNodeModelID = modelID; } else if(!CapabilitiesUtil.isSameConnector(critNodeModelID, modelID, metadata, capFinder) && (!considerConformed || !RuleRaiseAccess.isConformed(metadata, capFinder, aNode.getConformedTo(), modelID, null, critNodeModelID))) { return null; } } catch(QueryMetadataException e) { throw new TeiidComponentException(QueryPlugin.Event.TEIID30272, e, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30272)); } return critNodeModelID; }
public static Object validateCommandPushdown(Object critNodeModelID, QueryMetadataInterface metadata, CapabilitiesFinder capFinder, AccessNode aNode, boolean considerConformed) throws TeiidComponentException { // Check that query in access node is for the same model as current node try { if (!(aNode.getCommand() instanceof QueryCommand)) { return null; } Object modelID = aNode.getModelId(); if (critNodeModelID == null) { critNodeModelID = modelID; } else if(!CapabilitiesUtil.isSameConnector(critNodeModelID, modelID, metadata, capFinder) && (!considerConformed || !RuleRaiseAccess.isConformed(metadata, capFinder, aNode.getConformedTo(), modelID, null, critNodeModelID))) { return null; } } catch(QueryMetadataException e) { throw new TeiidComponentException(QueryPlugin.Event.TEIID30272, e, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30272)); } return critNodeModelID; }
if (aNode != null) { String modelName = aNode.getModelName(); command = aNode.getCommand(); SourceCapabilities caps = capabilitiesFinder.findCapabilities(modelName); supportPreparedBatchUpdate = caps.supportsCapability(SourceCapabilities.Capability.BULK_UPDATE);
public static Object validateCommandPushdown(Object critNodeModelID, QueryMetadataInterface metadata, CapabilitiesFinder capFinder, AccessNode aNode, boolean considerConformed) throws TeiidComponentException { // Check that query in access node is for the same model as current node try { if (!(aNode.getCommand() instanceof QueryCommand)) { return null; } Object modelID = aNode.getModelId(); if (critNodeModelID == null) { critNodeModelID = modelID; } else if(!CapabilitiesUtil.isSameConnector(critNodeModelID, modelID, metadata, capFinder) && (!considerConformed || !RuleRaiseAccess.isConformed(metadata, capFinder, aNode.getConformedTo(), modelID, null, critNodeModelID))) { return null; } } catch(QueryMetadataException e) { throw new TeiidComponentException(QueryPlugin.Event.TEIID30272, e, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30272)); } return critNodeModelID; }
AccessNode aNode = (AccessNode)rPlan.getRootNode(); String modelName = aNode.getModelName(); command = aNode.getCommand(); SourceCapabilities caps = capabilitiesFinder.findCapabilities(modelName); supportPreparedBatchUpdate = caps.supportsCapability(SourceCapabilities.Capability.BULK_UPDATE);
if (aNode != null) { String modelName = aNode.getModelName(); command = aNode.getCommand(); SourceCapabilities caps = capabilitiesFinder.findCapabilities(modelName); supportPreparedBatchUpdate = caps.supportsCapability(SourceCapabilities.Capability.BULK_UPDATE);
private static RelationalNode multiSourceModify(AccessNode accessNode, Expression ex, QueryMetadataInterface metadata, List<String> sourceNames) throws TeiidComponentException, TeiidProcessingException { List<AccessNode> accessNodes = new ArrayList<AccessNode>(); boolean hasOutParams = RelationalNodeUtil.hasOutputParams(accessNode.getCommand()); if (!Constant.NULL_CONSTANT.equals(ex)) { for(String sourceName:sourceNames) { Command command = accessNode.getCommand(); throw new QueryProcessingException(QueryPlugin.Event.TEIID30561, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30561, accessNode.getCommand())); case 0: if (RelationalNodeUtil.isUpdate(accessNode.getCommand())) { if (RelationalNodeUtil.isUpdate(accessNode.getCommand())) { GroupingNode groupNode = new GroupingNode(accessNode.getID()); AggregateSymbol sumCount = new AggregateSymbol(NonReserved.SUM, false, accessNode.getElements().get(0));
private static RelationalNode multiSourceModify(AccessNode accessNode, Expression ex, QueryMetadataInterface metadata, List<String> sourceNames) throws TeiidComponentException, TeiidProcessingException { List<AccessNode> accessNodes = new ArrayList<AccessNode>(); boolean hasOutParams = RelationalNodeUtil.hasOutputParams(accessNode.getCommand()); if (!Constant.NULL_CONSTANT.equals(ex)) { for(String sourceName:sourceNames) { Command command = accessNode.getCommand(); throw new QueryProcessingException(QueryPlugin.Event.TEIID30561, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30561, accessNode.getCommand())); case 0: if (RelationalNodeUtil.isUpdate(accessNode.getCommand())) { if (RelationalNodeUtil.isUpdate(accessNode.getCommand())) { GroupingNode groupNode = new GroupingNode(accessNode.getID()); AggregateSymbol sumCount = new AggregateSymbol(NonReserved.SUM, false, accessNode.getElements().get(0));
Command command = accessNode.getCommand(); if (command instanceof Insert && ((Insert)command).getQueryExpression() != null) { command = ((Insert)command).getQueryExpression();
private static RelationalNode multiSourceModify(AccessNode accessNode, Expression ex, QueryMetadataInterface metadata, List<String> sourceNames) throws TeiidComponentException, TeiidProcessingException { List<AccessNode> accessNodes = new ArrayList<AccessNode>(); boolean hasOutParams = RelationalNodeUtil.hasOutputParams(accessNode.getCommand()); if (!Constant.NULL_CONSTANT.equals(ex)) { for(String sourceName:sourceNames) { Command command = accessNode.getCommand(); throw new QueryProcessingException(QueryPlugin.Event.TEIID30561, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30561, accessNode.getCommand())); case 0: if (RelationalNodeUtil.isUpdate(accessNode.getCommand())) { if (RelationalNodeUtil.isUpdate(accessNode.getCommand())) { GroupingNode groupNode = new GroupingNode(accessNode.getID()); AggregateSymbol sumCount = new AggregateSymbol(NonReserved.SUM, false, accessNode.getElements().get(0));
Command command = accessNode.getCommand(); if (command instanceof Insert && ((Insert)command).getQueryExpression() != null) { command = ((Insert)command).getQueryExpression();
static void getDependentGroups(RelationalNode node, Set<String> depGroups, boolean depdenent) { if(node instanceof AccessNode) { if (node instanceof DependentAccessNode) { if (!depdenent) { return; } } else if (depdenent) { return; } AccessNode accessNode = (AccessNode)node; Command depCommand = accessNode.getCommand(); Collection<GroupSymbol> groupSymbols = GroupCollectorVisitor.getGroups(depCommand, true); for (GroupSymbol groupSymbol : groupSymbols) { depGroups.add(groupSymbol.getNonCorrelationName().toUpperCase()); } } // Recurse through children RelationalNode[] children = node.getChildren(); for(int i=0; i<children.length; i++) { if(children[i] != null) { getDependentGroups(node.getChildren()[i], depGroups, depdenent); } } }