columns.set(i, new Column(replacement, column.getPropertyName(), column.getColumnName()));
}
}
break;
case SELECT:
Constraint constraint = planNode.getProperty(Property.SELECT_CRITERIA, Constraint.class);
Constraint newConstraint = replaceReferencesToRemovedSource(context, constraint, rewrittenSelectors);
if (constraint != newConstraint) {
planNode.setProperty(Property.SELECT_CRITERIA, newConstraint);
}
break;
case SORT:
List<Object> orderBys = planNode.getPropertyAsList(Property.SORT_ORDER_BY, Object.class);
if (orderBys != null && !orderBys.isEmpty()) {
if (orderBys.get(0) instanceof SelectorName) {
for (int i = 0; i != orderBys.size(); ++i) {
SelectorName selectorName = (SelectorName)orderBys.get(i);
SelectorName replacement = rewrittenSelectors.get(selectorName);
if (replacement != null) {
orderBys.set(i, replacement);
}
}
} else {
for (int i = 0; i != orderBys.size(); ++i) {
Ordering ordering = (Ordering)orderBys.get(i);
DynamicOperand operand = ordering.getOperand();
orderBys.set(i, replaceReferencesToRemovedSource(context, operand, rewrittenSelectors));
}
}
}
break;
case JOIN:
// Update the join condition ...
JoinCondition joinCondition = planNode.getProperty(Property.JOIN_CONDITION, JoinCondition.class);
JoinCondition newCondition = replaceReferencesToRemovedSource(context, joinCondition, rewrittenSelectors);
if (joinCondition != newCondition) {
planNode.setProperty(Property.JOIN_CONDITION, newCondition);
}
// Update the join criteria (if there are some) ...
List<Constraint> constraints = planNode.getPropertyAsList(Property.JOIN_CONSTRAINTS, Constraint.class);
if (constraints != null && !constraints.isEmpty()) {
for (int i = 0; i != constraints.size(); ++i) {
Constraint old = constraints.get(i);
Constraint replacement = replaceReferencesToRemovedSource(context, old, rewrittenSelectors);
if (replacement != old) {
constraints.set(i, replacement);
}
}
}