use of org.teiid.query.processor.relational.AccessNode in project teiid by teiid.
the class TestConformedTables method testConformedJoin.
@Test
public void testConformedJoin() throws Exception {
String sql = "select pm1.g1.e1 from pm1.g1, pm2.g2 where g1.e1=g2.e1";
RelationalPlan plan = (RelationalPlan) helpPlan(sql, tm, new String[] { "SELECT g_0.e1 FROM pm1.g1 AS g_0, pm2.g2 AS g_1 WHERE g_0.e1 = g_1.e1" }, ComparisonMode.EXACT_COMMAND_STRING);
AccessNode anode = (AccessNode) plan.getRootNode();
assertEquals("pm2", anode.getModelName());
// it should work either way
sql = "select pm1.g1.e1 from pm2.g2, pm1.g1 where g1.e1=g2.e1";
plan = (RelationalPlan) helpPlan(sql, tm, new String[] { "SELECT g_1.e1 FROM pm2.g2 AS g_0, pm1.g1 AS g_1 WHERE g_1.e1 = g_0.e1" }, ComparisonMode.EXACT_COMMAND_STRING);
anode = (AccessNode) plan.getRootNode();
assertEquals("pm2", anode.getModelName());
}
use of org.teiid.query.processor.relational.AccessNode in project teiid by teiid.
the class TestDependentJoins method getDependentGroups.
static void getDependentGroups(RelationalNode node, Set<String> depGroups, boolean depdenent) {
if (node instanceof AccessNode) {
if (node instanceof DependentAccessNode) {
if (!depdenent) {
return;
}
} else if (depdenent) {
return;
}
AccessNode accessNode = (AccessNode) node;
Command depCommand = accessNode.getCommand();
Collection<GroupSymbol> groupSymbols = GroupCollectorVisitor.getGroups(depCommand, true);
for (GroupSymbol groupSymbol : groupSymbols) {
depGroups.add(groupSymbol.getNonCorrelationName().toUpperCase());
}
}
// Recurse through children
RelationalNode[] children = node.getChildren();
for (int i = 0; i < children.length; i++) {
if (children[i] != null) {
getDependentGroups(node.getChildren()[i], depGroups, depdenent);
}
}
}
Aggregations