// Resolve the node to find the definition in the schemata ...
SelectorName tableName = sourceNode.getProperty(Property.SOURCE_NAME, SelectorName.class);
SelectorName tableAlias = sourceNode.getProperty(Property.SOURCE_ALIAS, SelectorName.class);
Table table = schemata.getTable(tableName);
if (table instanceof View) {
View view = (View)table;
PlanNode viewPlan = planner.createPlan(context, view.getDefinition());
if (viewPlan == null) continue; // there were likely errors when creating the plan
// If the view doesn't have an alias, or if the view's alias doesn't match the table's name/alias ...
PlanNode viewProjectNode = viewPlan.findAtOrBelow(Type.PROJECT);
if (viewProjectNode.getSelectors().size() == 1) {