Source source,
Map<SelectorName, Table> usedSelectors ) {
if (source instanceof Selector) {
// No join required ...
assert source instanceof AllNodes || source instanceof NamedSelector;
Selector selector = (Selector)source;
PlanNode node = new PlanNode(Type.SOURCE);
if (selector.hasAlias()) {
node.addSelector(selector.getAlias());
node.setProperty(Property.SOURCE_ALIAS, selector.getAlias());
node.setProperty(Property.SOURCE_NAME, selector.getName());
} else {
node.addSelector(selector.getName());
node.setProperty(Property.SOURCE_NAME, selector.getName());
}
// Validate the source name and set the available columns ...
Table table = context.getSchemata().getTable(selector.getName());
if (table != null) {
if (table instanceof View) context.getHints().hasView = true;
if (usedSelectors.put(selector.getAliasOrName(), table) != null) {
// There was already a table with this alias or name ...
}
node.setProperty(Property.SOURCE_COLUMNS, table.getColumns());
} else {
context.getProblems().addError(GraphI18n.tableDoesNotExist, selector.getName());
}
return node;
}
if (source instanceof Join) {
Join join = (Join)source;