/** * Helper to quickly get the groups from obj in a collection. Duplicates * are removed. * @param obj Language object * @return Collection of {@link org.teiid.query.sql.symbol.GroupSymbol} */ public static final Set<GroupSymbol> getGroups(LanguageObject obj) { Set<GroupSymbol> groups = new LinkedHashSet<GroupSymbol>(); getGroups(obj, groups); return groups; }
/** * Helper to quickly get the groups from obj in a collection. Duplicates * are removed. * @param obj Language object * @return Collection of {@link org.teiid.query.sql.symbol.GroupSymbol} */ public static final Set<GroupSymbol> getGroups(LanguageObject obj) { Set<GroupSymbol> groups = new LinkedHashSet<GroupSymbol>(); getGroups(obj, groups); return groups; }
public static Set<GroupSymbol> getGroups(Collection<? extends LanguageObject> objects) { Set<GroupSymbol> groups = new LinkedHashSet<GroupSymbol>(); getGroups(objects, groups); return groups; }
public static Set<GroupSymbol> getGroups(Collection<? extends LanguageObject> objects) { Set<GroupSymbol> groups = new LinkedHashSet<GroupSymbol>(); getGroups(objects, groups); return groups; }
/** * Helper to quickly get the groups from obj in a collection. Duplicates * are removed. * @param obj Language object * @return Collection of {@link org.teiid.query.sql.symbol.GroupSymbol} */ public static final Set<GroupSymbol> getGroups(LanguageObject obj) { Set<GroupSymbol> groups = new LinkedHashSet<GroupSymbol>(); getGroups(obj, groups); return groups; }
public static Set<GroupSymbol> getGroups(Collection<? extends LanguageObject> objects) { Set<GroupSymbol> groups = new LinkedHashSet<GroupSymbol>(); getGroups(objects, groups); return groups; }
private List<Expression> filterElements(Collection<? extends Expression> requiredInput, Set<GroupSymbol> filterGroups) { List<Expression> filteredElements = new ArrayList<Expression>(); for (Expression element : requiredInput) { if(filterGroups.containsAll(GroupsUsedByElementsVisitor.getGroups(element))) { filteredElements.add(element); } } return filteredElements; }
private List<Expression> filterElements(Collection<? extends Expression> requiredInput, Set<GroupSymbol> filterGroups) { List<Expression> filteredElements = new ArrayList<Expression>(); for (Expression element : requiredInput) { if(filterGroups.containsAll(GroupsUsedByElementsVisitor.getGroups(element))) { filteredElements.add(element); } } return filteredElements; }
private List<Expression> filterElements(Collection<? extends Expression> requiredInput, Set<GroupSymbol> filterGroups) { List<Expression> filteredElements = new ArrayList<Expression>(); for (Expression element : requiredInput) { if(filterGroups.containsAll(GroupsUsedByElementsVisitor.getGroups(element))) { filteredElements.add(element); } } return filteredElements; }
public static void getGroups(Collection<? extends LanguageObject> objects, Set<GroupSymbol> groups) { // Get groups from elements for (LanguageObject languageObject : objects) { if (languageObject instanceof ElementSymbol) { ElementSymbol elem = (ElementSymbol) languageObject; groups.add(elem.getGroupSymbol()); } else { GroupsUsedByElementsVisitor.getGroups(languageObject, groups); } } }
public static void getGroups(Collection<? extends LanguageObject> objects, Set<GroupSymbol> groups) { // Get groups from elements for (LanguageObject languageObject : objects) { if (languageObject instanceof ElementSymbol) { ElementSymbol elem = (ElementSymbol) languageObject; groups.add(elem.getGroupSymbol()); } else { GroupsUsedByElementsVisitor.getGroups(languageObject, groups); } } }
public static void getGroups(Collection<? extends LanguageObject> objects, Set<GroupSymbol> groups) { // Get groups from elements for (LanguageObject languageObject : objects) { if (languageObject instanceof ElementSymbol) { ElementSymbol elem = (ElementSymbol) languageObject; groups.add(elem.getGroupSymbol()); } else { GroupsUsedByElementsVisitor.getGroups(languageObject, groups); } } }
private Set<GroupSymbol> getRequiredGroupSymbols(PlanNode planNode) { return GroupsUsedByElementsVisitor.getGroups((Collection<? extends LanguageObject>)planNode.getProperty(NodeConstants.Info.OUTPUT_COLS)); }
private Set<GroupSymbol> getRequiredGroupSymbols(PlanNode planNode) { return GroupsUsedByElementsVisitor.getGroups((Collection<? extends LanguageObject>)planNode.getProperty(NodeConstants.Info.OUTPUT_COLS)); }
private Set<GroupSymbol> getRequiredGroupSymbols(PlanNode planNode) { return GroupsUsedByElementsVisitor.getGroups((Collection<? extends LanguageObject>)planNode.getProperty(NodeConstants.Info.OUTPUT_COLS)); }
private static float getPredicateNDV(LanguageObject object, PlanNode currentNode, float childCost, QueryMetadataInterface metadata) throws QueryMetadataException, TeiidComponentException { Collection<ElementSymbol> elements = ElementCollectorVisitor.getElements(object, true); Collection<GroupSymbol> groups = GroupsUsedByElementsVisitor.getGroups(elements); boolean multiGroup = groups.size() > 1; float ndv = getStat(Stat.NDV, elements, currentNode, childCost, metadata); if (ndv == UNKNOWN_VALUE) { boolean usesKey = usesKey(elements, metadata); if (multiGroup) { if (usesKey) { ndv = (float)Math.ceil(Math.sqrt(childCost)); } else { ndv = (float)Math.ceil(Math.sqrt(childCost)/4); } } else if (usesKey) { ndv = childCost; } else { ndv = (float)Math.ceil(Math.sqrt(childCost)/2); } ndv = Math.max(ndv, 1); } return ndv; }
private static float getPredicateNDV(LanguageObject object, PlanNode currentNode, float childCost, QueryMetadataInterface metadata) throws QueryMetadataException, TeiidComponentException { Collection<ElementSymbol> elements = ElementCollectorVisitor.getElements(object, true); Collection<GroupSymbol> groups = GroupsUsedByElementsVisitor.getGroups(elements); boolean multiGroup = groups.size() > 1; float ndv = getStat(Stat.NDV, elements, currentNode, childCost, metadata); if (ndv == UNKNOWN_VALUE) { boolean usesKey = usesKey(elements, metadata); if (multiGroup) { if (usesKey) { ndv = (float)Math.ceil(Math.sqrt(childCost)); } else { ndv = (float)Math.ceil(Math.sqrt(childCost)/4); } } else if (usesKey) { ndv = childCost; } else { ndv = (float)Math.ceil(Math.sqrt(childCost)/2); } ndv = Math.max(ndv, 1); } return ndv; }
private void setCriteria(DependentSetCriteria dsc, PlanNode copyNode) { copyNode.setProperty(NodeConstants.Info.SELECT_CRITERIA, dsc); copyNode.getGroups().clear(); copyNode.addGroups(GroupsUsedByElementsVisitor.getGroups(dsc)); }
private void setCriteria(DependentSetCriteria dsc, PlanNode copyNode) { copyNode.setProperty(NodeConstants.Info.SELECT_CRITERIA, dsc); copyNode.getGroups().clear(); copyNode.addGroups(GroupsUsedByElementsVisitor.getGroups(dsc)); }
private void setCriteria(DependentSetCriteria dsc, PlanNode copyNode) { copyNode.setProperty(NodeConstants.Info.SELECT_CRITERIA, dsc); copyNode.getGroups().clear(); copyNode.addGroups(GroupsUsedByElementsVisitor.getGroups(dsc)); }