/** * Add the node as this node's parent. * @param node */ public void addAsParent(PlanNode node) { modified = true; if (this.parent != null) { this.parent.replaceChild(this, node); } assert node.getChildCount() == 0; node.addLastChild(this); }
/** * Add the node as this node's parent. * @param node */ public void addAsParent(PlanNode node) { modified = true; if (this.parent != null) { this.parent.replaceChild(this, node); } assert node.getChildCount() == 0; node.addLastChild(this); }
/** * Add the node as this node's parent. NOTE: This node * must already have a parent. * @param node */ public void addAsParent(PlanNode node) { modified = true; if (this.parent != null) { this.parent.replaceChild(this, node); } assert node.getChildCount() == 0; node.addLastChild(this); }
/** * all of child's children become children of parent */ public static final void removeChildNode(PlanNode parent, PlanNode child) { if (child.getChildCount() == 0) { parent.removeChild(child); } else if (child.getChildCount() == 1){ PlanNode grandChild = child.getFirstChild(); parent.replaceChild(child, grandChild); } else { throw new AssertionError("Cannot promote a multinode child"); //$NON-NLS-1$ } }
/** * all of child's children become children of parent */ public static final void removeChildNode(PlanNode parent, PlanNode child) { if (child.getChildCount() == 0) { parent.removeChild(child); } else if (child.getChildCount() == 1){ PlanNode grandChild = child.getFirstChild(); parent.replaceChild(child, grandChild); } else { throw new AssertionError("Cannot promote a multinode child"); //$NON-NLS-1$ } }
/** * all of child's children become children of parent */ public static final void removeChildNode(PlanNode parent, PlanNode child) { if (child.getChildCount() == 0) { parent.removeChild(child); } else if (child.getChildCount() == 1){ PlanNode grandChild = child.getFirstChild(); parent.replaceChild(child, grandChild); } else { throw new AssertionError("Cannot promote a multinode child"); //$NON-NLS-1$ } }
/** * 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); }
/** * Add the new union back in under a view */ static PlanNode rebuild(GroupSymbol group, PlanNode toReplace, PlanNode newUnion, QueryMetadataInterface metadata, CommandContext context, PlanNode... toMap) throws TeiidComponentException, QueryPlannerException, QueryMetadataException { Set<String> groups = context.getGroups(); group = RulePlaceAccess.recontextSymbol(group, groups); PlanNode projectNode = NodeEditor.findNodePreOrder(newUnion, NodeConstants.Types.PROJECT); List<? extends Expression> projectedSymbols = (List<? extends Expression>)projectNode.getProperty(Info.PROJECT_COLS); SymbolMap newSymbolMap = RulePushAggregates.createSymbolMap(group, projectedSymbols, newUnion, metadata); PlanNode view = RuleDecomposeJoin.createSource(group, newUnion, newSymbolMap); Map<Expression, ElementSymbol> inverseMap = newSymbolMap.inserseMapping(); if (toReplace != null) { toReplace.getParent().replaceChild(toReplace, view); } Set<GroupSymbol> newGroups = Collections.singleton(group); for (PlanNode node : toMap) { FrameUtil.convertFrame(view, node.getGroups().iterator().next(), newGroups, inverseMap, metadata); } return view; }
/** * Add the new union back in under a view */ static PlanNode rebuild(GroupSymbol group, PlanNode toReplace, PlanNode newUnion, QueryMetadataInterface metadata, CommandContext context, PlanNode... toMap) throws TeiidComponentException, QueryPlannerException, QueryMetadataException { Set<String> groups = context.getGroups(); group = RulePlaceAccess.recontextSymbol(group, groups); PlanNode projectNode = NodeEditor.findNodePreOrder(newUnion, NodeConstants.Types.PROJECT); List<? extends Expression> projectedSymbols = (List<? extends Expression>)projectNode.getProperty(Info.PROJECT_COLS); SymbolMap newSymbolMap = RulePushAggregates.createSymbolMap(group, projectedSymbols, newUnion, metadata); PlanNode view = RuleDecomposeJoin.createSource(group, newUnion, newSymbolMap); Map<Expression, ElementSymbol> inverseMap = newSymbolMap.inserseMapping(); if (toReplace != null) { toReplace.getParent().replaceChild(toReplace, view); } Set<GroupSymbol> newGroups = Collections.singleton(group); for (PlanNode node : toMap) { FrameUtil.convertFrame(view, node.getGroups().iterator().next(), newGroups, inverseMap, metadata); } return view; }
/** * Add the new union back in under a view */ static PlanNode rebuild(GroupSymbol group, PlanNode toReplace, PlanNode newUnion, QueryMetadataInterface metadata, CommandContext context, PlanNode... toMap) throws TeiidComponentException, QueryPlannerException, QueryMetadataException { Set<String> groups = context.getGroups(); group = RulePlaceAccess.recontextSymbol(group, groups); PlanNode projectNode = NodeEditor.findNodePreOrder(newUnion, NodeConstants.Types.PROJECT); List<? extends Expression> projectedSymbols = (List<? extends Expression>)projectNode.getProperty(Info.PROJECT_COLS); SymbolMap newSymbolMap = RulePushAggregates.createSymbolMap(group, projectedSymbols, newUnion, metadata); PlanNode view = RuleDecomposeJoin.createSource(group, newUnion, newSymbolMap); Map<Expression, ElementSymbol> inverseMap = newSymbolMap.inserseMapping(); if (toReplace != null) { toReplace.getParent().replaceChild(toReplace, view); } Set<GroupSymbol> newGroups = Collections.singleton(group); for (PlanNode node : toMap) { FrameUtil.convertFrame(view, node.getGroups().iterator().next(), newGroups, inverseMap, metadata); } return view; }
CapabilitiesFinder capFinder) throws QueryPlannerException, QueryMetadataException, TeiidComponentException, QueryResolverException { groupNode.getParent().replaceChild(groupNode, groupNode.getFirstChild());
private PlanNode raiseNullNode(PlanNode rootNode, PlanNode parentNode, PlanNode nullNode, List<PlanNode> nodes) { if (parentNode.getType() == NodeConstants.Types.SOURCE) { nullNode.getGroups().clear(); } else if (parentNode.getType() == NodeConstants.Types.PROJECT) { nullNode.setProperty(NodeConstants.Info.PROJECT_COLS, parentNode.getProperty(NodeConstants.Info.PROJECT_COLS)); } nullNode.addGroups(parentNode.getGroups()); parentNode.removeChild(nullNode); nodes.removeAll(NodeEditor.findAllNodes(parentNode, NodeConstants.Types.NULL)); if (parentNode.getParent() != null) { parentNode.getParent().replaceChild(parentNode, nullNode); } else { rootNode = nullNode; } return rootNode; }
CapabilitiesFinder capFinder) throws QueryPlannerException, QueryMetadataException, TeiidComponentException, QueryResolverException { groupNode.getParent().replaceChild(groupNode, groupNode.getFirstChild());
CapabilitiesFinder capFinder) throws QueryPlannerException, QueryMetadataException, TeiidComponentException, QueryResolverException { groupNode.getParent().replaceChild(groupNode, groupNode.getFirstChild());
private PlanNode raiseNullNode(PlanNode rootNode, PlanNode parentNode, PlanNode nullNode, List<PlanNode> nodes) { if (parentNode.getType() == NodeConstants.Types.SOURCE) { nullNode.getGroups().clear(); } else if (parentNode.getType() == NodeConstants.Types.PROJECT) { nullNode.setProperty(NodeConstants.Info.PROJECT_COLS, parentNode.getProperty(NodeConstants.Info.PROJECT_COLS)); } nullNode.addGroups(parentNode.getGroups()); parentNode.removeChild(nullNode); nodes.removeAll(NodeEditor.findAllNodes(parentNode, NodeConstants.Types.NULL)); if (parentNode.getParent() != null) { parentNode.getParent().replaceChild(parentNode, nullNode); } else { rootNode = nullNode; } return rootNode; }
private PlanNode raiseNullNode(PlanNode rootNode, PlanNode parentNode, PlanNode nullNode, List<PlanNode> nodes) { if (parentNode.getType() == NodeConstants.Types.SOURCE) { nullNode.getGroups().clear(); } else if (parentNode.getType() == NodeConstants.Types.PROJECT) { nullNode.setProperty(NodeConstants.Info.PROJECT_COLS, parentNode.getProperty(NodeConstants.Info.PROJECT_COLS)); } nullNode.addGroups(parentNode.getGroups()); parentNode.removeChild(nullNode); nodes.removeAll(NodeEditor.findAllNodes(parentNode, NodeConstants.Types.NULL)); if (parentNode.getParent() != null) { parentNode.getParent().replaceChild(parentNode, nullNode); } else { rootNode = nullNode; } return rootNode; }
limitNode.getParent().replaceChild(limitNode, limitNode.getFirstChild());
limitNode.getParent().replaceChild(limitNode, limitNode.getFirstChild());