private static final void findAllNodesHelper(PlanNode node, int types, List<PlanNode> foundNodes, int stopTypes) { if((node.getType() & types) == node.getType()) { foundNodes.add(node); } if(node.getChildCount() > 0 && (stopTypes == NodeConstants.Types.NO_TYPE || (stopTypes & node.getType()) != node.getType() ) ) { for (PlanNode child : node.getChildren()) { findAllNodesHelper(child, types, foundNodes, stopTypes); } } }
private static final void findAllNodesHelper(PlanNode node, int types, List<PlanNode> foundNodes, int stopTypes) { if((node.getType() & types) == node.getType()) { foundNodes.add(node); } if(node.getChildCount() > 0 && (stopTypes == NodeConstants.Types.NO_TYPE || (stopTypes & node.getType()) != node.getType() ) ) { for (PlanNode child : node.getChildren()) { findAllNodesHelper(child, types, foundNodes, stopTypes); } } }
private static final void findAllNodesHelper(PlanNode node, int types, List<PlanNode> foundNodes, int stopTypes) { if((node.getType() & types) == node.getType()) { foundNodes.add(node); } if(node.getChildCount() > 0 && (stopTypes == NodeConstants.Types.NO_TYPE || (stopTypes & node.getType()) != node.getType() ) ) { for (PlanNode child : node.getChildren()) { findAllNodesHelper(child, types, foundNodes, stopTypes); } } }
public void addParentCriteria(PlanNode sourceNode) { PlanNode parent = sourceNode.getParent(); while (parent != null && parent.getType() == NodeConstants.Types.SELECT) { criteriaNodes.add(parent); sourceNode = parent; parent = parent.getParent(); } if (joinRoot == null) { joinRoot = sourceNode; } }
public void addParentCriteria(PlanNode sourceNode) { PlanNode parent = sourceNode.getParent(); while (parent != null && parent.getType() == NodeConstants.Types.SELECT) { criteriaNodes.add(parent); sourceNode = parent; parent = parent.getParent(); } if (joinRoot == null) { joinRoot = sourceNode; } }
static void collectUnionChildren(PlanNode unionNode, List<PlanNode> unionChildren) { for (PlanNode child : unionNode.getChildren()) { if(child.getType() == NodeConstants.Types.SET_OP) { collectUnionChildren(child, unionChildren); } else { unionChildren.add(child); } } }
public void addParentCriteria(PlanNode sourceNode) { PlanNode parent = sourceNode.getParent(); while (parent != null && parent.getType() == NodeConstants.Types.SELECT) { criteriaNodes.add(parent); sourceNode = parent; parent = parent.getParent(); } if (joinRoot == null) { joinRoot = sourceNode; } }
static void collectUnionChildren(PlanNode unionNode, List<PlanNode> unionChildren) { for (PlanNode child : unionNode.getChildren()) { if(child.getType() == NodeConstants.Types.SET_OP) { collectUnionChildren(child, unionChildren); } else { unionChildren.add(child); } } }
static void collectUnionChildren(PlanNode unionNode, List<PlanNode> unionChildren) { for (PlanNode child : unionNode.getChildren()) { if(child.getType() == NodeConstants.Types.SET_OP) { collectUnionChildren(child, unionChildren); } else { unionChildren.add(child); } } }
static boolean isProcedure(PlanNode projectNode) { if(projectNode != null && projectNode.getType() == NodeConstants.Types.PROJECT && projectNode.getChildCount() > 0) { PlanNode accessNode = projectNode.getFirstChild(); Command command = getNonQueryCommand(accessNode); return command instanceof StoredProcedure; } return false; }
static boolean isProcedure(PlanNode projectNode) { if(projectNode != null && projectNode.getType() == NodeConstants.Types.PROJECT && projectNode.getChildCount() > 0) { PlanNode accessNode = projectNode.getFirstChild(); Command command = getNonQueryCommand(accessNode); return command instanceof StoredProcedure; } return false; }
static boolean isProcedure(PlanNode projectNode) { if(projectNode != null && projectNode.getType() == NodeConstants.Types.PROJECT && projectNode.getChildCount() > 0) { PlanNode accessNode = projectNode.getFirstChild(); Command command = getNonQueryCommand(accessNode); return command instanceof StoredProcedure; } return false; }
private boolean clean(PlanNode plan, boolean removeAllPhantom) throws TeiidComponentException { boolean pushRaiseNull = false; plan.setProperty(Info.OUTPUT_COLS, null); for (PlanNode node : plan.getChildren()) { pushRaiseNull |= clean(node, removeAllPhantom); } if (plan.getType() == NodeConstants.Types.SELECT) { pushRaiseNull |= cleanCriteria(plan, removeAllPhantom); } return pushRaiseNull; }
private boolean clean(PlanNode plan, boolean removeAllPhantom) throws TeiidComponentException { boolean pushRaiseNull = false; plan.setProperty(Info.OUTPUT_COLS, null); for (PlanNode node : plan.getChildren()) { pushRaiseNull |= clean(node, removeAllPhantom); } if (plan.getType() == NodeConstants.Types.SELECT) { pushRaiseNull |= cleanCriteria(plan, removeAllPhantom); } return pushRaiseNull; }
private boolean clean(PlanNode plan, boolean removeAllPhantom) throws TeiidComponentException { boolean pushRaiseNull = false; plan.setProperty(Info.OUTPUT_COLS, null); for (PlanNode node : plan.getChildren()) { pushRaiseNull |= clean(node, removeAllPhantom); } if (plan.getType() == NodeConstants.Types.SELECT) { pushRaiseNull |= cleanCriteria(plan, removeAllPhantom); } return pushRaiseNull; }
/** * Access nodes are not eligible originating nodes */ @Test public void testFindSourceNodeWithAccessSource() { PlanNode root = getExamplePlan(); Set<GroupSymbol> groups = new HashSet<GroupSymbol>(); groups.add(getGroup(2)); PlanNode originatingNode = FrameUtil.findOriginatingNode(root, groups); assertEquals(NodeConstants.Types.JOIN, originatingNode.getType()); }
@Test public void testFindSourceNode2() { PlanNode root = getExamplePlan(); Set<GroupSymbol> groups = new HashSet<GroupSymbol>(); groups.add(getGroup(3)); PlanNode originatingNode = FrameUtil.findOriginatingNode(root, groups); assertEquals(NodeConstants.Types.SOURCE, originatingNode.getType()); }
@Test public void testFindSourceNode() { PlanNode root = getExamplePlan(); Set<GroupSymbol> groups = new HashSet<GroupSymbol>(); groups.add(getGroup(1)); PlanNode originatingNode = FrameUtil.findOriginatingNode(root, groups); assertEquals(NodeConstants.Types.NULL, originatingNode.getType()); }
@Test public void testFindJoinSourceNode1() { PlanNode root = getExamplePlan(); PlanNode joinSource = FrameUtil.findJoinSourceNode(root.getLastChild()); assertEquals(NodeConstants.Types.JOIN, joinSource.getType()); }
/** * Simple test to ensure that the reconstruction logic doesn't fail with a single source */ public void testReconstructionOf1Source() { PlanNode source = NodeFactory.getNewNode(NodeConstants.Types.SOURCE); PlanNode accessNode = NodeFactory.getNewNode(NodeConstants.Types.ACCESS); source.addFirstChild(accessNode); JoinRegion region = new JoinRegion(); region.addJoinSourceNode(accessNode); region.reconstructJoinRegoin(); assertEquals(NodeConstants.Types.ACCESS, region.getJoinRoot().getType()); }