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)); }
public static PlanNode createProjectNode(List<? extends Expression> select) { PlanNode projectNode = NodeFactory.getNewNode(NodeConstants.Types.PROJECT); projectNode.setProperty(NodeConstants.Info.PROJECT_COLS, select); // Set groups projectNode.addGroups(GroupsUsedByElementsVisitor.getGroups(select)); return projectNode; }
public static PlanNode createProjectNode(List<? extends Expression> select) { PlanNode projectNode = NodeFactory.getNewNode(NodeConstants.Types.PROJECT); projectNode.setProperty(NodeConstants.Info.PROJECT_COLS, select); // Set groups projectNode.addGroups(GroupsUsedByElementsVisitor.getGroups(select)); return projectNode; }
public static PlanNode createProjectNode(List<? extends Expression> select) { PlanNode projectNode = NodeFactory.getNewNode(NodeConstants.Types.PROJECT); projectNode.setProperty(NodeConstants.Info.PROJECT_COLS, select); // Set groups projectNode.addGroups(GroupsUsedByElementsVisitor.getGroups(select)); return projectNode; }
public static PlanNode createSelectNode(final Criteria crit, boolean isHaving) { PlanNode critNode = NodeFactory.getNewNode(NodeConstants.Types.SELECT); critNode.setProperty(NodeConstants.Info.SELECT_CRITERIA, crit); //TODO: we should check for grouping expression correlations, but those are not yet set when this is // called in the planner, so we look for any subquery if (isHaving && (!ElementCollectorVisitor.getAggregates(crit, false).isEmpty() || !ValueIteratorProviderCollectorVisitor.getValueIteratorProviders(crit).isEmpty())) { critNode.setProperty(NodeConstants.Info.IS_HAVING, Boolean.TRUE); } // Add groups to crit node critNode.addGroups(GroupsUsedByElementsVisitor.getGroups(crit)); critNode.addGroups(GroupsUsedByElementsVisitor.getGroups(critNode.getCorrelatedReferenceElements())); return critNode; }
/** * special handling is needed since we are retaining the child aliases */ private static void correctOrderBy(PlanNode frame, PlanNode sort, List<Expression> selectSymbols, PlanNode parentProject) { if (sort == null || NodeEditor.findNodePreOrder(sort, NodeConstants.Types.PROJECT, NodeConstants.Types.SOURCE) != parentProject) { return; } List<Expression> childProject = (List<Expression>)NodeEditor.findNodePreOrder(frame, NodeConstants.Types.PROJECT).getProperty(NodeConstants.Info.PROJECT_COLS); OrderBy elements = (OrderBy)sort.getProperty(NodeConstants.Info.SORT_ORDER); for (OrderByItem item : elements.getOrderByItems()) { item.setSymbol(childProject.get(selectSymbols.indexOf(item.getSymbol()))); } sort.getGroups().clear(); sort.addGroups(GroupsUsedByElementsVisitor.getGroups(elements)); }
public static PlanNode createSortNode(OrderBy orderBy) { PlanNode sortNode = NodeFactory.getNewNode(NodeConstants.Types.SORT); sortNode.setProperty(NodeConstants.Info.SORT_ORDER, orderBy); if (orderBy.hasUnrelated()) { sortNode.setProperty(Info.UNRELATED_SORT, true); } sortNode.addGroups(GroupsUsedByElementsVisitor.getGroups(orderBy)); return sortNode; }
public static PlanNode createSortNode(OrderBy orderBy) { PlanNode sortNode = NodeFactory.getNewNode(NodeConstants.Types.SORT); sortNode.setProperty(NodeConstants.Info.SORT_ORDER, orderBy); if (orderBy.hasUnrelated()) { sortNode.setProperty(Info.UNRELATED_SORT, true); } sortNode.addGroups(GroupsUsedByElementsVisitor.getGroups(orderBy)); return sortNode; }
/** * Replaces the given node with a NULL node. This will also preserve * the groups that originate under the node on the NULL node * * @param node */ static void replaceWithNullNode(PlanNode node) { PlanNode nullNode = NodeFactory.getNewNode(NodeConstants.Types.NULL); PlanNode source = FrameUtil.findJoinSourceNode(node); if (source != null) { nullNode.addGroups(source.getGroups()); } node.getParent().replaceChild(node, nullNode); }
/** * Replaces the given node with a NULL node. This will also preserve * the groups that originate under the node on the NULL node * * @param node */ static void replaceWithNullNode(PlanNode node) { PlanNode nullNode = NodeFactory.getNewNode(NodeConstants.Types.NULL); PlanNode source = FrameUtil.findJoinSourceNode(node); if (source != null) { nullNode.addGroups(source.getGroups()); } node.getParent().replaceChild(node, nullNode); }
/** * Replaces the given node with a NULL node. This will also preserve * the groups that originate under the node on the NULL node * * @param node */ static void replaceWithNullNode(PlanNode node) { PlanNode nullNode = NodeFactory.getNewNode(NodeConstants.Types.NULL); PlanNode source = FrameUtil.findJoinSourceNode(node); if (source != null) { nullNode.addGroups(source.getGroups()); } node.getParent().replaceChild(node, nullNode); }
private void connectSubqueryContainers(PlanNode plan, boolean skipPlanning) throws QueryPlannerException, QueryMetadataException, TeiidComponentException { for (PlanNode node : getAllPossibleSubqueryNodes(plan)) { Set<GroupSymbol> groupSymbols = getGroupSymbols(node); List<SubqueryContainer<?>> subqueryContainers = node.getSubqueryContainers(); planSubqueries(groupSymbols, node, subqueryContainers, false, skipPlanning); node.addGroups(GroupsUsedByElementsVisitor.getGroups(node.getCorrelatedReferenceElements())); } }
private void connectSubqueryContainers(PlanNode plan) throws QueryPlannerException, QueryMetadataException, TeiidComponentException { for (PlanNode node : NodeEditor.findAllNodes(plan, NodeConstants.Types.PROJECT | NodeConstants.Types.SELECT | NodeConstants.Types.JOIN | NodeConstants.Types.SOURCE | NodeConstants.Types.GROUP | NodeConstants.Types.SORT)) { Set<GroupSymbol> groupSymbols = getGroupSymbols(node); List<SubqueryContainer<?>> subqueryContainers = node.getSubqueryContainers(); planSubqueries(groupSymbols, node, subqueryContainers, false); node.addGroups(GroupsUsedByElementsVisitor.getGroups(node.getCorrelatedReferenceElements())); } }
private void connectSubqueryContainers(PlanNode plan, boolean skipPlanning) throws QueryPlannerException, QueryMetadataException, TeiidComponentException { for (PlanNode node : getAllPossibleSubqueryNodes(plan)) { Set<GroupSymbol> groupSymbols = getGroupSymbols(node); List<SubqueryContainer<?>> subqueryContainers = node.getSubqueryContainers(); planSubqueries(groupSymbols, node, subqueryContainers, false, skipPlanning); node.addGroups(GroupsUsedByElementsVisitor.getGroups(node.getCorrelatedReferenceElements())); } }
private PlanNode removeUnnecessaryInlineView(PlanNode root, PlanNode accessNode) { PlanNode child = accessNode.getFirstChild(); if (child.hasBooleanProperty(NodeConstants.Info.INLINE_VIEW)) { child.removeProperty(NodeConstants.Info.INLINE_VIEW); root = RuleRaiseAccess.performRaise(root, child, accessNode); //add the groups from the lower project accessNode.getGroups().clear(); PlanNode sourceNode = FrameUtil.findJoinSourceNode(accessNode.getFirstChild()); if (sourceNode != null) { accessNode.addGroups(sourceNode.getGroups()); } accessNode.setProperty(Info.OUTPUT_COLS, accessNode.getFirstChild().getProperty(Info.OUTPUT_COLS)); } return root; }