PlanNode rewrittenSource = planRewriter.rewrite(node.getSource(), null);
if (context != null) {
return new TopNNode(node.getId(), rewrittenSource, context.getCount(), node.getOrderBy(), node.getOrderings(), false);
}
else if (rewrittenSource != node.getSource()) {
return new SortNode(node.getId(), rewrittenSource, node.getOrderBy(), node.getOrderings());
}
return node;
}