PlanNode rightNode = joinNode.getLastChild().findAtOrBelow(Type.SOURCE);
assert leftNode != null;
assert rightNode != null;
EquiJoinCondition equiJoin = (EquiJoinCondition)condition;
// Find the names (or aliases) of the tables ...
Schemata schemata = context.getSchemata();
assert schemata != null;
SelectorName leftTableName = leftNode.getProperty(Property.SOURCE_NAME, SelectorName.class);
SelectorName rightTableName = rightNode.getProperty(Property.SOURCE_NAME, SelectorName.class);
assert leftTableName != null;
assert rightTableName != null;
// Presumably the join condition is using at least one alias, but we only care about the actual name ...
if (!leftTableName.equals(rightTableName)) {
// The join is not joining the same table, so this doesn't meet the condition ...
continue;
}
// Find the schemata columns referenced by the join condition ...
Table table = schemata.getTable(leftTableName);
if (table == null) {
context.getProblems().addError(GraphI18n.tableDoesNotExist, leftTableName);
continue;
}
String leftColumnName = equiJoin.getProperty1Name();