use of org.teiid.query.resolver.util.AccessPattern in project teiid by teiid.
the class FrameUtil method convertAccessPatterns.
/**
* @param symbolMap
* @param node
* @throws QueryPlannerException
*/
private static void convertAccessPatterns(Map symbolMap, PlanNode node) throws QueryPlannerException {
List<AccessPattern> accessPatterns = (List<AccessPattern>) node.getProperty(NodeConstants.Info.ACCESS_PATTERNS);
if (accessPatterns != null) {
for (AccessPattern ap : accessPatterns) {
Set<ElementSymbol> newElements = new HashSet<ElementSymbol>();
for (Iterator<ElementSymbol> elems = ap.getUnsatisfied().iterator(); elems.hasNext(); ) {
ElementSymbol symbol = elems.next();
Expression mapped = convertExpression(symbol, symbolMap);
newElements.addAll(ElementCollectorVisitor.getElements(mapped, true));
}
ap.setUnsatisfied(newElements);
Set<ElementSymbol> newHistory = new HashSet<ElementSymbol>();
for (Iterator<ElementSymbol> elems = ap.getCurrentElements().iterator(); elems.hasNext(); ) {
ElementSymbol symbol = elems.next();
Expression mapped = convertExpression(symbol, symbolMap);
newHistory.addAll(ElementCollectorVisitor.getElements(mapped, true));
}
ap.addElementHistory(newHistory);
}
Collections.sort(accessPatterns);
}
}
use of org.teiid.query.resolver.util.AccessPattern in project teiid by teiid.
the class FrameUtil method canConvertAccessPatterns.
static boolean canConvertAccessPatterns(PlanNode sourceNode) {
List<AccessPattern> accessPatterns = (List) sourceNode.getProperty(NodeConstants.Info.ACCESS_PATTERNS);
if (accessPatterns == null) {
return true;
}
SymbolMap symbolMap = (SymbolMap) sourceNode.getProperty(NodeConstants.Info.SYMBOL_MAP);
for (Iterator<AccessPattern> i = accessPatterns.iterator(); i.hasNext(); ) {
AccessPattern ap = i.next();
for (Iterator<ElementSymbol> elems = ap.getUnsatisfied().iterator(); elems.hasNext(); ) {
ElementSymbol symbol = elems.next();
Expression mapped = convertExpression(symbol, symbolMap.asMap());
if (ElementCollectorVisitor.getElements(mapped, true).isEmpty()) {
return false;
}
}
}
return true;
}
use of org.teiid.query.resolver.util.AccessPattern in project teiid by teiid.
the class JoinRegion method addJoinSourceNode.
public void addJoinSourceNode(PlanNode sourceNode) {
PlanNode root = sourceNode;
while (root.getParent() != null && root.getParent().getType() == NodeConstants.Types.SELECT) {
root = root.getParent();
}
if (sourceNode.hasCollectionProperty(NodeConstants.Info.ACCESS_PATTERNS)) {
Collection<AccessPattern> aps = (Collection<AccessPattern>) sourceNode.getProperty(NodeConstants.Info.ACCESS_PATTERNS);
unsatisfiedAccessPatterns.add(aps);
dependentJoinSourceNodes.put(sourceNode, root);
} else {
joinSourceNodes.put(sourceNode, root);
}
if (joinRoot == null) {
joinRoot = root;
}
}
Aggregations